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_news-0.1.0.pre3 spec/dummy/lib/master_model.rb
enju_news-0.1.0.pre2 spec/dummy/lib/master_model.rb
enju_news-0.1.0.pre spec/dummy/lib/master_model.rb
enju_news-0.0.5 spec/dummy/lib/master_model.rb
enju_circulation-0.0.71 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.70 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.69 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.68 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.67 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.66 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.65 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.64 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.63 spec/dummy/lib/enju_leaf/master_model.rb
enju_news-0.0.4 spec/dummy/lib/master_model.rb
enju_circulation-0.0.62 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.61 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.60 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.59 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.58 spec/dummy/lib/enju_leaf/master_model.rb
enju_circulation-0.0.57 spec/dummy/lib/enju_leaf/master_model.rb