Module: Olelo::Attributes
- Included in:
- Page
- Defined in:
- lib/olelo/attributes.rb
Overview
Include module to add attribute editor to a class.
Defined Under Namespace
Modules: ClassMethods Classes: Attribute, AttributeDSL, AttributeGroup
Class Method Summary collapse
Instance Method Summary collapse
-
#attribute_editor ⇒ String
Generate attribute editor form.
-
#update_attributes(params) ⇒ Hash
Parse attributes from params hash.
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/olelo/attributes.rb', line 4 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#attribute_editor ⇒ String
Generate attribute editor form
281 282 283 |
# File 'lib/olelo/attributes.rb', line 281 def attribute_editor self.class.attribute_group.build_form(attributes).html_safe end |
#update_attributes(params) ⇒ Hash
Parse attributes from params hash
271 272 273 |
# File 'lib/olelo/attributes.rb', line 271 def update_attributes(params) self.attributes = self.class.attribute_group.parse(params) end |