Module: CIMI::Helpers::SelectBaseMethods

Included in:
Model::Base
Defined in:
lib/cimi/helpers/select_helper.rb

Instance Method Summary collapse

Instance Method Details

#select_attributes(attr_list) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cimi/helpers/select_helper.rb', line 48

def select_attributes(attr_list)
  attrs = attr_list.inject({}) do |result, attr|
    attr = attr.to_s.underscore
    result[attr.to_sym] = self.send(attr) if self.respond_to?(attr)
    result
  end
  self.class.new(attrs.merge(
    :select_attr_list => attr_list,
    :base_id => self.send(:id)
  ))
end