module Olelo::Attributes

Include module to add attribute editor to a class.

Public Class Methods

included(base) click to toggle source
# File lib/olelo/attributes.rb, line 4
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

attribute_editor() click to toggle source

Generate attribute editor form

@param [Hash] default_values to use for the form @return [String] Generated html form @api public

# File lib/olelo/attributes.rb, line 281
def attribute_editor
  self.class.attribute_group.build_form(attributes).html_safe
end
update_attributes(params) click to toggle source

Parse attributes from params hash

@param [Hash] params submitted params hash @return [Hash] Attributes @api public

# File lib/olelo/attributes.rb, line 271
def update_attributes(params)
  self.attributes = self.class.attribute_group.parse(params)
end