diff options
author | Xavier Noria <fxn@hashref.com> | 2011-01-20 10:33:38 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-01-20 10:33:38 +0100 |
commit | 236f1f52cdcb695ee42ec1ad384fc9bee643f435 (patch) | |
tree | d618fb10c41909f826b57e8a0589ed442d186f5a /activerecord/lib/active_record/relation | |
parent | a282301a77288252d135855d088f20de2397998e (diff) | |
parent | 94e0f1db1cf17aa86fed5d7dad50f9e82238900a (diff) | |
download | rails-236f1f52cdcb695ee42ec1ad384fc9bee643f435.tar.gz rails-236f1f52cdcb695ee42ec1ad384fc9bee643f435.tar.bz2 rails-236f1f52cdcb695ee42ec1ad384fc9bee643f435.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/spawn_methods.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index db5f1af5ca..69a7642ec5 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -63,6 +63,13 @@ module ActiveRecord alias :& :merge + # Removes from the query the condition(s) specified in +skips+. + # + # Example: + # + # Post.order('id asc').except(:order) # discards the order condition + # Post.where('id > 10').order('id asc').except(:where) # discards the where condition but keeps the order + # def except(*skips) result = self.class.new(@klass, table) @@ -77,6 +84,13 @@ module ActiveRecord result end + # Removes any condition from the query other than the one(s) specified in +onlies+. + # + # Example: + # + # Post.order('id asc').only(:where) # discards the order condition + # Post.order('id asc').only(:where, :order) # uses the specified order + # def only(*onlies) result = self.class.new(@klass, table) |