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

已查看 24 次
跳至第一个未读帖子

Anthony Kerz

未读,
2013年11月14日 17:43:262013/11/14
收件人 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

未读,
2013年11月14日 18:09:402013/11/14
收件人 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

未读,
2013年11月14日 22:58:202013/11/14
收件人 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
回复全部
回复作者
转发
0 个新帖子