From 30d2627cff29252efe4d711bb9d9bc2b1719293c Mon Sep 17 00:00:00 2001 From: AvnerCohen Date: Tue, 23 Oct 2012 13:02:34 +0200 Subject: Another batch of hash syntax changes to comment, this time around, I tried to keep 'output' messages untouched. --- activerecord/lib/active_record/relation.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record/relation.rb') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 2e2286e4fd..cb9cc5a9df 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -235,7 +235,7 @@ module ActiveRecord # Scope all queries to the current scope. # - # Comment.where(:post_id => 1).scoping do + # Comment.where(post_id: 1).scoping do # Comment.first # SELECT * FROM comments WHERE post_id = 1 # end # @@ -266,7 +266,7 @@ module ActiveRecord # Book.where('title LIKE ?', '%Rails%').update_all(author: 'David') # # # Update all books that match conditions, but limit it to 5 ordered by date - # Book.where('title LIKE ?', '%Rails%').order(:created_at).limit(5).update_all(:author => 'David') + # Book.where('title LIKE ?', '%Rails%').order(:created_at).limit(5).update_all(author: 'David') def update_all(updates) raise ArgumentError, "Empty list of attributes to change" if updates.blank? @@ -339,7 +339,7 @@ module ActiveRecord # # Person.destroy_all("last_login < '2004-04-04'") # Person.destroy_all(status: "inactive") - # Person.where(:age => 0..18).destroy_all + # Person.where(age: 0..18).destroy_all def destroy_all(conditions = nil) if conditions where(conditions).destroy_all @@ -384,7 +384,7 @@ module ActiveRecord # # Post.delete_all("person_id = 5 AND (category = 'Something' OR category = 'Else')") # Post.delete_all(["person_id = ? AND (category = ? OR category = ?)", 5, 'Something', 'Else']) - # Post.where(:person_id => 5).where(:category => ['Something', 'Else']).delete_all + # Post.where(person_id: 5).where(category: ['Something', 'Else']).delete_all # # Both calls delete the affected posts all at once with a single DELETE statement. # If you need to destroy dependent associations or call your before_* or @@ -514,7 +514,7 @@ module ActiveRecord # Joins that are also marked for preloading. In which case we should just eager load them. # Note that this is a naive implementation because we could have strings and symbols which # represent the same association, but that aren't matched by this. Also, we could have - # nested hashes which partially match, e.g. { :a => :b } & { :a => [:b, :c] } + # nested hashes which partially match, e.g. { a: :b } & { a: [:b, :c] } def joined_includes_values includes_values & joins_values end -- cgit v1.2.3