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



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

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)},
                           :as => :customized,
                           :inverse_of => :customized,
                           :dependent => :delete_all,
                           :validate => false

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