version snippets

Ignoring columns with acts_as_versioned

Tagged version, acts_as_versioned, exclude  Languages ruby
def Model

  @@versioned_columns = [:title, :body, :rendered_body, :user_id]  
  acts_as_versioned :if_changed => @@versioned_columns

  def self.non_versioned_columns
      self.class.columns.collect(&:name) - @@versioned_columns
  end
end

Reading gem version from YAML

Tagged jeweler, version, gem, rubygem  Languages ruby

From Jekyll:

module YerGem
  def self.version
    yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
    "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
  end
end