class BeStrong::StrongParameterMethods
Public Class Methods
method_for(name)
click to toggle source
# File lib/be_strong/strong_parameter_methods.rb, line 3 def self.method_for(name) model = Model.new(name) permits = model.accessible_attributes.map{|attr| ":#{attr}"}.join(', ') permit_method = permits.present? ? ".permit(#{permits})" : '' <<-"EOS".strip_heredoc def #{name}_params params.require(:#{name})#{permit_method} end EOS rescue NameError nil end