Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add fields to the params hash

I am trying to pass a value from a view to the controller. The user is submitting a form, and I want to pass a hidden value which is not related to the form itself. So my question is: how can I manually add entries to the params hash?

like image 512
klaffenboeck Avatar asked Jun 20 '11 09:06

klaffenboeck


1 Answers

Use params.merge.

See docs: http://ruby-doc.org/core/classes/Hash.html#M000759

A similar question: Rails - Is there a shortcut to pass all existing params?

like image 50
sscirrus Avatar answered Nov 19 '22 21:11

sscirrus