Monday, May 24, 2010

[Rails] Re: ActionController::DoubleRenderError

Frederick Cheung wrote:
> On May 24, 11:36�am, Ravi Dtv <li...@ruby-forum.com> 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.

def dispfriends
@myfriend=[]
@myfriendlogin = []

i=0
@currentgroup = Group.find_by_id(params[:groupid])

puts @currentgroup.id

@currentfriends=
GroupFriend.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
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@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


Real Estate