Skip to content

Instantly share code, notes, and snippets.

@baileylo
Created October 15, 2010 06:56
Show Gist options
  • Select an option

  • Save baileylo/627747 to your computer and use it in GitHub Desktop.

Select an option

Save baileylo/627747 to your computer and use it in GitHub Desktop.
Modifying applications models so they're aware of eachother
class Board < ActiveRecord::Base
has_many :conversations
end
class Comment < ActiveRecord::Base
belongs_to :conversation
belongs_to :user
validates_presence_of :body
end
class Conversation < ActiveRecord::Base
has_many :comments
belongs_to :user
belongs_to :board
validates_presence_of :title
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment