hidden field just to pass to controller but not be bound to entity...?

24 views
Skip to first unread message

Anthony Kerz

unread,
Nov 14, 2013, 5:43:26 PM11/14/13
to plataformate...@googlegroups.com
i have something like:

<%= f.input :referrer, :as => :hidden, value: request.referrer %>

but i get an error about referrer not being a method on the entity that the form is bound to.

for that field, i really just want the controller to pluck it out of params.

is there any way to tell simple_form not to attempt to bind that field...?

regards,
tony.

Vasiliy Ermolovich

unread,
Nov 14, 2013, 6:09:40 PM11/14/13
to plataformate...@googlegroups.com
No, just use hidden_field_tag for this.

Anthony Kerz wrote:
--
You received this message because you are subscribed to the Google
Groups "SimpleForm" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to plataformatec-simp...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Anthony Kerz

unread,
Nov 14, 2013, 10:58:20 PM11/14/13
to plataformate...@googlegroups.com
thanks vasily,

  <%= hidden_field_tag("referrer", request.referrer) %>

did the trick!

On Thursday, November 14, 2013 6:09:40 PM UTC-5, Vasiliy Ermolovich wrote:
No, just use hidden_field_tag for this.

Anthony Kerz wrote:

i have something like:

<%= f.input :referrer, :as => :hidden, value: request.referrer %>

but i get an error about referrer not being a method on the entity
that the form is bound to.

for that field, i really just want the controller to pluck it out of
params.

is there any way to tell simple_form not to attempt to bind that field...?

regards,
tony.

--
You received this message because you are subscribed to the Google
Groups "SimpleForm" group.
To unsubscribe from this group and stop receiving emails from it, send
Reply all
Reply to author
Forward
0 new messages