Added a named scope to make history lookups easier, Rate.history_for_user(user). #1915
This commit is contained in:
1 parent
5296368183
commit
33d1f84878
2 files changed
+9
-1
No files matched your search
@@ -5,4 +5,12 @@ class Rate < ActiveRecord::Base
|
||||
|
||||
validates_presence_of :user_id
|
||||
validates_presence_of :date_in_effect
|
||||
|
||||
named_scope :history_for_user, lambda { |user|
|
||||
{
|
||||
:conditions => { :user_id => user.id },
|
||||
:order => 'date_in_effect DESC'
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user