UPenn on Rails pt 1
Upcoming SlideShare
Loading in...5
×
 

UPenn on Rails pt 1

on

  • 1,009 views

 

Statistics

Views

Total Views
1,009
Views on SlideShare
886
Embed Views
123

Actions

Likes
0
Downloads
7
Comments
0

2 Embeds 123

http://railslessons.com 122
http://preview.railslessons.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

UPenn on Rails pt 1 UPenn on Rails pt 1 Presentation Transcript

  • UPenn on Rails Lesson 1: Data and Views
  • DataViews
  • Data
  • class Team• name• (id, created_at, updated_at)
  • class Location• name• address• (id, created_at, updated_at)
  • class Game• starts_at• ends_at• location• home_team• away_team• (id, created_at, updated_at)
  • class Game• starts_at• ends_at class Location• location• home_team• away_team• (id, created_at, updated_at)
  • class Game• starts_at• ends_at class Location• location• home_team class Team• away_team• (id, created_at, updated_at)
  • CODE!
  • Database Migrations• live in db/migrate• ordered• Abstracted SQL column types• includes id and timestamps by default
  • MORE CODE!
  • RESTful Routes• GET /locations (show all locations)• GET /locations/3 (show one location)• POST /locations (make a location)• PUT /locations/3 (update one location)
  • Can also be nested• GET /locations/3/games (show games for one location)
  • ‘public’ folder• For all static files• Rails looks here first• Offers caching options
  • Views
  • ERB• Like JSP/ASP, but in ruby• lots of helper functions for forms, etc.• layout → view → partials
  • VIEW CODE!
  • ActiveRecord Associations• 1 to 1 (belongs_to - has_one)• 1 to many (belongs_to - has_many)• many to many (has_many :through)
  • Other points• Controllers• Next class: User stories and testing!
  • Homework• Make a Player scaffold• Show the players for a given team on that team’s page• (bonus) assign players on the team edit page• Help at http://railsforzombies.org/