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.56 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.55 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.54 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.53 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.52 spec/dummy/lib/enju_leaf/master_model.rb
enju_biblio-0.0.2 lib/enju_biblio/master_model.rb
enju_news-0.0.3 spec/dummy/lib/master_model.rb
enju_news-0.0.2 spec/dummy/lib/master_model.rb
enju_biblio-0.0.1 lib/enju_biblio/master_model.rb
enju_library-0.0.1 lib/enju_library/master_model.rb
enju_circulation-0.0.51 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.50 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.49 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.48 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.47 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.46 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.45 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.43 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.42 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.41 spec/dummy/lib/enju_leaf/master_model.rb