lib/vestal_versions.rb in laserlemon-vestal_versions-0.2.1 vs lib/vestal_versions.rb in laserlemon-vestal_versions-0.2.2

- old
+ new

@@ -4,11 +4,11 @@ base.extend ClassMethods end module ClassMethods def versioned - has_many :versions, :as => :versioned, :order => 'versions.number', :dependent => :destroy, :autosave => true do + has_many :versions, :as => :versioned, :class_name => 'VestalVersion', :order => 'versions.number', :dependent => :destroy, :autosave => true do def current first(:conditions => {:number => versioned.version}) end def at(value) @@ -20,10 +20,10 @@ end end def between(from_value, to_value) from, to = at(from_value), at(to_value) - return [] unless [from, to].all?{|v| v.is_a?(Version) } + return [] unless [from, to].all?{|v| v.is_a?(VestalVersion) } all( :conditions => {:number => ([from, to].min.number..[from, to].max.number)}, :order => "versions.number #{(from > to) ? 'DESC' : 'ASC'}" ) end