Rendering a result from a different controller

Hi,

I am a bit new at rails, so I’m not sure how to approach this:

I have a view with a search box that calls a controller/model outside
of the view. So the view I am working with is called ‘groups’ and I
make a search to people, in another controller. I’d like the result
of the search to get sent back to my view under groups.

Here’s what I have in the view:

show.erb:
<% form_tag ({ :controller=> ‘people’, :action=> ‘index’}, :method=>
‘get’) do %>

Name: <%= text_field_tag :search_name, params[:search_name]%> <%= submit_tag "Search", :name=> nil %>

<%end %>

So instead of the result rendering in index under ‘people’, I’d like
to get the array back and render a list of people in groups. I tried
working with partials, but the issue is I need to get the array back
into this view, so I can pass it to a partial.

My controller code in people looks like this (I put the logic in the
model)

def people_search
@people_tree_searches = PeopleTreeV.search(params[:search_name])
end
end

any pointers are appreciated

thanks

Hi

 You can look at :collection This is likein your routes.rb you can 

add

map.resources :people, :collection => {:search => :any}

I am assuming map.resources :people is already there

Now you can have a method search in people controller and the
corresponding view may/maynot in view/people

Sijo

thanks, I will give this a try. Just out of curiosity, will I be able
to add functionality to the partial?