I'm trying to pass association values as hidden field in simple form
so same functionality like when you do …
= simple form for @document do |f|
= f.association :clients
…but will generate hidden field insted
I'm trying to do it as this
= f.association :clients, as: hidden
but that wont work obviously
only thing that works for me is
%input{ name: 'document[client_ids][]', value: '1'}
%input{ name: 'document[client_ids][]', value: '2'}
%input{ name: 'document[client_ids][]', value: '3'}
Best Answer
Maybe
but I think you'd be better of explaining the bigger picture and then we can suggest a suitable rails answer for you. In most cases using hidden fields is a sign that something should be done a better way.