Module: ActsAsConfigurable::ClassMethods
- Defined in:
- lib/acts_as_configurable.rb
Overview
This acts_as
extension provides the capabilities of defining configuration values.
Example:
class User < ActiveRecord::Base
acts_as_configurable :class_name => 'Ste::Configuration'
end
user.configure.name = 'Name'
user.configure.name => Name
Instance Method Summary collapse
Instance Method Details
#acts_as_configurable(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/acts_as_configurable.rb', line 19 def acts_as_configurable(={}) configuration = { :as => :configurable, :dependent => :destroy, :class_name => 'Configuration' } configuration.update() if .is_a? Hash class_eval <<-EOV include ActsAsConfigurable::InstanceMethods has_many :configs, configuration accepts_nested_attributes_for :configs, :allow_destroy => true EOV end |