On 20 May 2010 17:19, Ravi Dtv <li...@ruby-forum.com> wrote: >...> > When debugging i find currentgroupid is nill. > > How can I solve this. Possible solutions to pass values form partial to > controller. > <% @groups.each do |g| %> > <p> > <h5> > <%= link_to_remote g.group_name, :update => "abc", :url => { > :controller => > "users" , :action => "showfriendslist" } %> > > <%= hidden_field_tag :group_name %> > </h5> > </p> > <% end %> > > I can see my groupname displaying in my page, but when I click on my > groupname link, Im not able to pass groupname to my controller.
Using a hidden field does not work as you are not in a form. That is how to do it if you were submitting from a form. Instead just include the name in the url - something like <%= link_to_remote g.group_name, :update => "abc", :url => { :controller => "users" , :action => "showfriendslist", :group_name => g.group_name } %> Look at the html generated by this to check that it is being included correctly. Colin > > > My controller: > > def showfriendslist > > @currentgroupid=Group.find_by_group_name(params[:group_name]).id > > �...@friendsingroup=groupfriend.find_all_by_user_id_and_group_id(current_user.id,@currentgroupid) > > respond_to do |format| > format.html {render :partial => "friendlist" } > > format.xml > end -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.