rails 4 modelname_params doesn't exist -
i trying make contact form in rails 4 , ruby 2. i've added model , migrated db , made form etc, code gives error.
@newsupport = support.new(support_params) adminmailer.contact_email(@newsupport.name, @newsupport.email, @newsupport.subject, @newsupport.message).deliver
rails debugger says that:
undefined local variable or method `support_params' #<maincontroller:0x007f9f8a0dcb28>
why support_params undefined? can define it? didn't scaffold it, when scaffold, saw can link form values variable in controller via "modelname_params", in case undefined.
thanks reading.
it's wanting use strong_parameters (http://weblog.rubyonrails.org/2012/3/21/strong-parameters/) sanitize params in controller.
not sure why undefined, should defined in controller private method.
private #assuming you're using params[:support] def support_params params.require(:support).permit(:attributes, :you, :want, :to, :allow) end
Comments
Post a Comment