def dispfriends @myfriend=[] @myfriendlogin = [] i=0 @currentgroup = Group.find_by_id(params[:groupid]) puts @currentgroup.id @currentfriendsGroupFriend.find_all_by_user_id_and_group_id(current_user.id, @currentgroup.id) for n in @currentfriends @myfriend=n.friend_id @myusers = User.find_by_id(@myfriend) @myfriendlogin[i]=@myusers.login puts @myfriendlogin[i] i=i+1 respond_to do |format| format.html { render :partial => ''users/dispfriends'', :locals => {:user => @myusers}} end end end Error: ActionController::DoubleRenderError in UsersController#dispfriends Can only render or redirect once per action But, I need to display all the values in @myusers. How can I pass the values? Please help. Thank you. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 24, 11:36 am, Ravi Dtv <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> But, I need to display all the values in @myusers. > How can I pass the values? >if you pass the :collection option render will render the partial once for each item in the collection Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Frederick Cheung wrote:> On May 24, 11:36�am, Ravi Dtv <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> But, I need to display all the values in @myusers. >> How can I pass the values? >> > > if you pass the :collection option render will render the partial once > for each item in the collection > > FredThanks Fred for your reply. I modified with the following , but i get only the last value. def dispfriends @myfriend=[] @myfriendlogin = [] i=0 @currentgroup = Group.find_by_id(params[:groupid]) puts @currentgroup.id @currentfriendsGroupFriend.find_all_by_user_id_and_group_id(current_user.id, @currentgroup.id) for n in @currentfriends @myfriend=n.friend_id @myusers = User.find_by_id(@myfriend) @myfriendlogin[i]=-CIUIhguxapI4ZGfkFBByjQ@public.gmane.org puts @myfriendlogin[i] i=i+1 end respond_to do |format| # format.html { render :partial => ''users/dispfriends'', :locals => {:user => @myusers}} format.html { render :partial => ''users/dispfriends'', :collections => @myusers} end end Im very new to rails please help me in modifying my controller. Thank you. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On May 25, 6:34 am, Ravi Dtv <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote: > > On May 24, 11:36 am, Ravi Dtv <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > >> But, I need to display all the values in @myusers. > >> How can I pass the values? > > > if you pass the :collection option render will render the partial once > > for each item in the collection > > > Fred > > Thanks Fred for your reply. > > I modified with the following , but i get only the last value. >I''m not entirely sure what you''re trying to do but the option is spelled :collection not :collections and the @myusers object you passed is a single object rather than an array, Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.