Module: MasterModel

Defined in:
lib/enju_core/master_model.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/enju_core/master_model.rb', line 2

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,
      :message => I18n.t('Only lowercase letters and numbers are allowed.')
    validates :name, :presence => true
    validates :display_name, :presence => true
    before_validation :set_display_name, :on => :create
    normalize_attributes :name
  end
end