Fixing the named scope issue by using an anonymous scope.

This commit is contained in:
Ben Zittlau 2011-03-28 11:13:05 -06:00
parent 1485151e29
commit 3a92a1b9aa
1 changed files with 3 additions and 3 deletions

View File

@ -2,9 +2,9 @@ class Version < ActiveRecord::Base
belongs_to :item, :polymorphic => true
validates_presence_of :event
scope :with_item_keys, lambda { |item_type, item_id|
where(:item_type => item_type, :item_id => item_id)
}
def self.with_item_keys(item_type, item_id)
scoped(:conditions => { :item_type => item_type, :item_id => item_id })
end
scope :subsequent, lambda { |version|
where(["id > ?", version.is_a?(self) ? version.id : version]).order("id ASC")