[Rails] Re: How to pass array of values from controller to partial
Hi Ravi
Ravi Dtv wrote:
@myfriendlogin.each do |user|
respond_to do |format|
format.html { render :partial => 'users/dispfriends', :collection =>
@myfriendlogin, :as => :user}
end
end
---------------------------
I think your problem is in the above piece of code - A controller can
only respond to a request once. Your code will work if @myfriendlogin
only has one element, but will fail when it has more than one as the
webserver cannot send multiple responses back to the browser.
The ':collection => ' bit will already tell the partial to iterate
through the elements of the collection and apply each element to the
partial, so you dont need to put this into a loop.
If you just want to pass stuff to the partial you might want to look at
':locals =>'
What are you actually trying to achieve?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home