Created
August 30, 2011 02:15
-
-
Save stevenharman/1179987 to your computer and use it in GitHub Desktop.
Thing.first.discussions.started_by(User.first)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Discussion < ActiveRecord::Base | |
belongs_to :thing | |
scope :started_by lambda { |user| where(:initiated_by_id => user) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing < ActiveRecord::Base | |
belongs_to :user | |
has_many :discussions | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
has_many :things | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment