Module: VersionExtensions

Defined in:
lib/has-versions.rb

Instance Method Summary collapse

Instance Method Details

#commitableObject



17
18
19
# File 'lib/has-versions.rb', line 17

def commitable
  draft.where("created_at!=updated_at")
end

#snapshot(version) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/has-versions.rb', line 8

def snapshot( version )
  content_with_right_version = []
  content_present_in_this_version = self.where("version <= '#{version}'").group(:uid)
  content_present_in_this_version.each do |c|
    content_with_right_version << self.where(:uid =>c.uid).where("version <= '#{version}'").order('version DESC').first
  end
  return content_with_right_version
end