Sha256: 6a444f0f46cad2bb40e519a3415c49cbdfa44011666c4e1a8e1ad0381c804273

Contents?: true

Size: 527 Bytes

Versions: 71

Compression:

Stored size: 527 Bytes

Contents

module MasterModel
  def self.included(base)
    #base.extend ClassMethods
    base.send :include, InstanceMethods
    base.class_eval do
      acts_as_list
      validates_uniqueness_of :name, :case_sensitive => false
      validates_presence_of :name, :display_name
      before_validation :set_display_name, :on => :create
      normalize_attributes :name
    end
  end

  module InstanceMethods
    def set_display_name
      self.display_name = "#{I18n.locale}: #{self.name}" if self.display_name.blank?
    end
  end
end

Version data entries

71 entries across 71 versions & 5 rubygems

Version Path
enju_circulation-0.0.21 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.20 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.19 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.18 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.17 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.16 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.15 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.14 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.13 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.12 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.11 spec/dummy/lib/enju_leaf/master_model.rb