Rails Active Record Associations
Associations between database tables is incredibly important. I’ve been working on a volunteer tracking app for nonprofits that has several tables and many associations. I found out the hard way why you should always choose the has_many through association instead of the has_and_belongs_to_many_association (habtm). I…
Polymorphic Associations
Had my first interview with Thoughtbot today. The interviewer asked me a question about how I would handle having comments for different objects in a discussion board (Posts, Images, Articles). My answer was to have a bunch of foreign keys under a comments model/table. …
Rails Routes
resources :photos HTTP Verb Path Action Used for GET /photos index-display a list of all photos GET /photos/new new-return an HTML form for creating a new photo POST /photoscreatecreate a new photo GET /photos/:id show-display a specific photo GET /photos/:id/edit edit-return an HTML form for…