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