diff options
author | AvnerCohen <israbirding@gmail.com> | 2012-11-10 17:16:21 +0200 |
---|---|---|
committer | AvnerCohen <israbirding@gmail.com> | 2012-11-10 17:16:21 +0200 |
commit | 890da5149df19c54124929ff8b533014b6b46e69 (patch) | |
tree | 6a7f19b90ab939482e94b5af5a32d76057a2e708 /activerecord/lib/active_record/relation/query_methods.rb | |
parent | dcf401e3bc7163aefab856abe7f1d238025c4ef9 (diff) | |
download | rails-890da5149df19c54124929ff8b533014b6b46e69.tar.gz rails-890da5149df19c54124929ff8b533014b6b46e69.tar.bz2 rails-890da5149df19c54124929ff8b533014b6b46e69.zip |
1.9 Syntax related changes
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 4fdc296c7e..81ad0cc768 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -357,17 +357,17 @@ module ActiveRecord # author = Author.find(1) # # # The following queries will be equivalent: - # Post.where(:author => author) - # Post.where(:author_id => author) + # Post.where(author: author) + # Post.where(author_id: author) # # This also works with polymorphic belongs_to relationships: # - # treasure = Treasure.create(:name => 'gold coins') - # treasure.price_estimates << PriceEstimate.create(:price => 125) + # treasure = Treasure.create(name: 'gold coins') + # treasure.price_estimates << PriceEstimate.create(price: 125) # # # The following queries will be equivalent: - # PriceEstimate.where(:estimate_of => treasure) - # PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) + # PriceEstimate.where(estimate_of: treasure) + # PriceEstimate.where(estimate_of_type: 'Treasure', estimate_of_id: treasure) # # === Joins # @@ -379,7 +379,7 @@ module ActiveRecord # For hash conditions, you can either use the table name in the key, or use a sub-hash. # # User.joins(:posts).where({ "posts.published" => true }) - # User.joins(:posts).where({ :posts => { :published => true } }) + # User.joins(:posts).where({ posts: { published: true } }) # # === empty condition # @@ -478,13 +478,13 @@ module ActiveRecord # # For example: # - # @posts = current_user.visible_posts.where(:name => params[:name]) + # @posts = current_user.visible_posts.where(name: params[:name]) # # => the visible_posts method is expected to return a chainable Relation # # def visible_posts # case role # when 'Country Manager' - # Post.where(:country => country) + # Post.where(country: country) # when 'Reviewer' # Post.published # when 'Bad User' |