Sha256: 0071fb1154fc13b0f169d2aa2931cd7f7c1e947363e0905849a0797d59d0b6df

Contents?: true

Size: 522 Bytes

Versions: 3

Compression:

Stored size: 522 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

  # attr_accessible :image, :name

  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.3 app/models/illustration.rb
tkh_illustrations-0.9.2 app/models/illustration.rb
tkh_illustrations-0.9.1 app/models/illustration.rb