Method: BootstrapAdminHelper#attributes

Defined in:
app/helpers/bootstrap_admin_helper.rb

#attributesBootstrapAdmin::Attribute Array

Finds the model instance attributes to use for the current action.

First it checks if the bootstrap_admin_config has fields configured for the current action. If so, it uses those, if not, it tries to guess which attributes to use through the model’s “accessible_attributes”

Returns:



238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'app/helpers/bootstrap_admin_helper.rb', line 238

def attributes
  return @attributes if @attributes
  model_klass = model_for controller
  fields =  bootstrap_admin_config.send("#{params[:action]}_fields")  ||
            bootstrap_admin_config.send("action_fields")              ||
            find_attributes_for_class(model_klass)

  @attributes = fields.map do |att|
    BootstrapAdmin::Attribute.new att,
                                  model_klass.human_attribute_name(att),
                                  model_klass.type_of(att)
  end
end