Search action/ in different groups

Hi all,
thanks in advance for those who’ll take the time to help out…
i have a list of users who are connected with a habtam relashinship to a
set of groups (joint table of groups_users) and now am trying to
implement a search operation that will go through all of the records of
the users and output user results according to what group was chosen at
the searchbar, and the text input(of the searchbar)

basicly, it would be something in the vicinity of

(( @groups = Group.find_all ))

view of users/index:

'index' > search: <% for group in @groups %> <% end %>

and then in my controller i put

def index
@users = User.find(:all) # annitiate the variable
@groups = Group.find(:all)
if params[:searchbar] != nil # no search
@user_pages, @users = paginate :users, :include => :groups, :order =>
‘lastname’ , :per_page => 10
else # search done
@groups.each {|group|
if params[“group#{id}”] == “on” #checbox is
associated_group = Group.find(
@users << associated_group

but every time i put in a search query i get this (now) annoying message

undefined method `update’ for “dfasdf”:String

even though i have no UPDATE method in the controller !
what is going on?


two small fixes…

     @users.groups << associated_group

undefined method `update’ for “dfasdf”:String
(as the “dfasdf” is the text input in the search field)