ruby-on-railsrails-activerecordhoneypot

How to call a field in my controller


I have a comments model, and within that model, I have a field called :honey.

In the view, :honey is a hidden form field.

In the controller, when the form posts I want it to redirect to the home page if :honey is filled out.

How do I call that specific field in my controller?


Solution

  • If you're talking about when your form posts back to your action, you should be checking params. Either look in your logs or use binding.pry and look for the key and value you're expecting.

    It will probably be params[:comment][:honey].