Module: Redmine::Acts::Customizable::ClassMethods
- Defined in:
- vendor/plugins/acts_as_customizable/lib/acts_as_customizable.rb
Instance Method Summary
Instance Method Details
- (Object) acts_as_customizable(options = {})
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'vendor/plugins/acts_as_customizable/lib/acts_as_customizable.rb', line 26 def acts_as_customizable( = {}) return if self.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods) cattr_accessor :customizable_options self. = has_many :custom_values, :as => :customized, :include => :custom_field, :order => "#{CustomField.table_name}.position", :dependent => :delete_all before_validation_on_create { |customized| customized.custom_field_values } # Trigger validation only if custom values were changed validates_associated :custom_values, :on => :update, :if => Proc.new { |customized| customized.custom_field_values_changed? } send :include, Redmine::Acts::Customizable::InstanceMethods # Save custom values when saving the customized object after_save :save_custom_field_values end |