diff options
author | AvnerCohen <israbirding@gmail.com> | 2012-10-23 13:02:34 +0200 |
---|---|---|
committer | AvnerCohen <israbirding@gmail.com> | 2012-10-23 13:02:34 +0200 |
commit | 30d2627cff29252efe4d711bb9d9bc2b1719293c (patch) | |
tree | 357140e588be44764f91e1177c6bbcf0259b047f /activerecord/lib/active_record/relation.rb | |
parent | 6004fd336a95b2f951042d9c231f58b762582e75 (diff) | |
download | rails-30d2627cff29252efe4d711bb9d9bc2b1719293c.tar.gz rails-30d2627cff29252efe4d711bb9d9bc2b1719293c.tar.bz2 rails-30d2627cff29252efe4d711bb9d9bc2b1719293c.zip |
Another batch of hash syntax changes to comment, this time around, I tried to keep 'output' messages untouched.
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 10 |
1 files changed, 5 insertions, 5 deletions
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 <tt>before_*</tt> 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 |