git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16001
e93f8b46-1217-0410-a6f0-
8f06a7374b81
# Finds versions of a specific model. Takes an options hash like <tt>find</tt>
def find_versions(id, options = {})
- versioned_class.all({
- :conditions => ["#{versioned_foreign_key} = ?", id],
- :order => 'version' }.merge(options))
+ versioned_class.
+ where(options[:conditions] || {versioned_foreign_key => id}).
+ limit(options[:limit]).
+ order('version')
end
# Returns an array of columns that are versioned. See non_versioned_columns