Class: BeStrong::StrongParameterMethods::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/be_strong/strong_parameter_methods.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Model

Returns a new instance of Model.



18
19
20
# File 'lib/be_strong/strong_parameter_methods.rb', line 18

def initialize(name)
  @klass = name.to_s.classify.constantize
end

Instance Method Details

#accessible_attributesObject



22
23
24
25
26
27
# File 'lib/be_strong/strong_parameter_methods.rb', line 22

def accessible_attributes
  accssible = @klass.accessible_attributes
  return accssible if accssible.size.nonzero?

  @klass.attribute_names - @klass.protected_attributes.to_a
end