Thursday, 15 September 2011

Data between Partials and Parent View Ruby on Rails -



Data between Partials and Parent View Ruby on Rails -

so have new.html.erb contains form new ad. view renders partial upload images called _upload_control.html.erb. contains <%= file_field_tag :fileupload %> , i'm trying reference uploaded in new.html.erb in order file in parent's controller. there way this?

as per comment

the partial i'm rendering in form used upload multiple files different object, not using 'f'

you should utilize f(form builder) , need pass form builder in locals partial can called particular form builder, like:

<%= form_for resource1 |f| %> <%= render :partial => 'upload_control', :locals => { :f => f } %> <% end %> <%= form_for resource2 |builder| %> <%= render :partial => 'upload_control', :locals => { :builder => f } %> <% end %>

and partial _upload_control.html.erb

<%= f.file_field :fileupload %>

ruby-on-rails model-view-controller partials

No comments:

Post a Comment