Sha256: a60972e7a70cd5ed37bfa0e43d8008d3938bc038c6a875c1b25e06b9847b109d

Contents?: true

Size: 487 Bytes

Versions: 3

Compression:

Stored size: 487 Bytes

Contents

# this is needed for now to make mass assignment security compatible with the translation of globalize3
# Globalize::ActiveRecord::Translation.class_eval do
#   attr_accessible :locale
# end

class Illustration < ActiveRecord::Base

  validates_presence_of :name

  translates :name

  mount_uploader :image, ImageUploader

  def to_param
    name ? "#{id}-#{name.to_url}" : id
  end

  scope :by_recent, -> { order('updated_at desc') }
  scope :alphabetically, -> { order('name') }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tkh_illustrations-0.9.6 app/models/illustration.rb
tkh_illustrations-0.9.5 app/models/illustration.rb
tkh_illustrations-0.9.4 app/models/illustration.rb