Forum: Ruby on Rails Passing params between actions?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0fcceb8cbefc2b99369fe7ba676d4384?d=identicon&s=25 Eric Beland (Guest)
on 2006-05-09 05:49
(Received via mailing list)
I am wondering what are the rules for the availability of params in
controller actions?  If I redirect, are the params still available?  How
about when I render a different action?  It doesn't seem so...  What are
the
best ways to pass them?

I'm trying to use an ajax scaffold component with 2 actions which load
different data for the component.  I have an ajax scaffold component
"listings" that I want to use on one page for "new listings" and on a
different page for "listings search results".  I'm also trying to make
the
"search" action save an object called "saved_search" with the search
parameters so the searches can be re-run later.

So where should code specific to the search action go?  I dont' want to
put
it in component_update as then both actions would use it.  But if I put
it
in the search action, I'm not sure how to then pass the params on to the
component_action?

  if @params[:saved_search_id]
      @saved_search = SavedSearch.find(params[:saved_search_id])
    else
      @saved_search = SavedSearch.new
      saved_search.update_attributes(params[:saved_search])
  end

Thanks to Brian Hughes and Liquid for great answers on my doc question!
Thanks,

Eric
This topic is locked and can not be replied to.