Skip to content

Instantly share code, notes, and snippets.

@romaimperator
Created May 9, 2014 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romaimperator/057f801fbb7746a07207 to your computer and use it in GitHub Desktop.
Save romaimperator/057f801fbb7746a07207 to your computer and use it in GitHub Desktop.
class Location < ActiveRecord::Base
has_many :bids
def accepted_bids
bids.merge(Bid.accepted)
end
end
class Bid < ActiveRecord::Base
belongs_to :location
def self.accepted
where(status: "accepted")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment