klaffenboeck
klaffenboeck

Reputation: 6377

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?

Upvotes: 6

Views: 13687

Answers (1)

sscirrus
sscirrus

Reputation: 56779

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?

Upvotes: 5

Related Questions