Skip to content

Instantly share code, notes, and snippets.

@hardbap
Created October 24, 2008 14:58
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 hardbap/19445 to your computer and use it in GitHub Desktop.
Save hardbap/19445 to your computer and use it in GitHub Desktop.
fixed code sample from section 5.3 of Rails 2.2 release notes
# fixed code sample from section 5.3 of Rails 2.2 release notes.
class Photo < ActiveRecord::Base
belongs_to :product
end
class Product < ActiveRecord::Base
has_many :photos
end
# Get all products with copyright-free photos:
Product.find(:all, :joins => :photos,
:conditions => { :photos => { :copyright => false }})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment