Module: Redmine::Acts::Customizable::ClassMethods

Defined in:
lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_customizable(options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb', line 26

def acts_as_customizable(options = {})
  return if self.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods)
  cattr_accessor :customizable_options
  self.customizable_options = options
  has_many :custom_values, lambda {includes(:custom_field).order("#{CustomField.table_name}.position")},
                           :as => :customized,
                           :dependent => :delete_all,
                           :validate => false

  send :include, Redmine::Acts::Customizable::InstanceMethods
  validate :validate_custom_field_values
  after_save :save_custom_field_values
end