Using components to reuse code


#1

the following is the code of the controller, under the dir
components/test/:

class Test::GroupsManController < ApplicationController

uses_component_template_root

def add_to_group
@account = Account.find_by_nick(@params[:nick])
# render :text => “#{session[:account_id]}
#{Group.find(session[:group_id]).owner_id}”

if (session[:account_id] == Group.find(session[:group_id]).owner_id)
 	Account.join_group(@account.id, session[:group_id])

render_component (:controller => ‘test/groups_man’, :action =>

‘group_list’)
group_list
else
render :partial => ‘group_error’
end

end

def group_list

@group = Group.find(session[:group_id])
@account = @group.accounts.find(:all)

render :partial => ‘group_list’

end

the problem come when I want to render :partial => ‘group_list’. It
seems that with partial( as well as link_to_remote), so using ajax,
there is a problem. Actually this code will update the whole page.

I read this topic in “components:pursuing the pipe dream”. Maybe what
I’m trying to do is not completly supported …

Antekirtt