I have a simple client search screen that posts the following params:
Parameters: {"search"=>"Search",
"action"=>"list",
"client_search"=>{"first_name"=>"jane",
last_name"=>"smith"},
"controller"=>"client"}
This works fine. However I want to redirect to the same destination to
do the search without the intervening screen.
I have used the code:
redirect_to :action=>"list", :client_search=>{:first_name
=>
"jane",:last_name=>"smith"}
This does not work.. the parameters appear as:
Parameters: {"action"=>"list",
"client_search"=>"last_namesmithfirst_namejane",
"controller"=>"client"}
ie it is not nesting the "client_search" hash and I get the following
error when trying to update the attributes on the client_search table
using these params:
NoMethodError (undefined method `stringify_keys!'' for
"last_namesmithfirst_namejane":String):
E:/RailsApps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1668:in `attributes=''
E:/RailsApps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1591:in `update_attributes''
Can anyone tell me what I am doing wrong and how to get around the
problem.
Thanks
George
--~--~---------~--~----~------------~-------~--~----~
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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
try out the flash: flash[:client_search] = params[:client_search] they should then be available in the flash to the next controller instance invoked by the redirect. good luck Tim On Jul 24, 3:24 pm, giorgio <george.pever...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a simple client search screen that posts the following params: > > Parameters: {"search"=>"Search", "action"=>"list", > "client_search"=>{"first_name"=>"jane", last_name"=>"smith"}, > "controller"=>"client"} > > This works fine. However I want to redirect to the same destination to > do the search without the intervening screen. > I have used the code: > redirect_to :action=>"list", :client_search=>{:first_name => > "jane",:last_name=>"smith"} > > This does not work.. the parameters appear as: > Parameters: {"action"=>"list", > "client_search"=>"last_namesmithfirst_namejane", > "controller"=>"client"} > > ie it is not nesting the "client_search" hash and I get the following > error when trying to update the attributes on the client_search table > using these params: > NoMethodError (undefined method `stringify_keys!'' for > "last_namesmithfirst_namejane":String): > E:/RailsApps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ > active_record/base.rb:1668:in `attributes='' > E:/RailsApps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ > active_record/base.rb:1591:in `update_attributes'' > > Can anyone tell me what I am doing wrong and how to get around the > problem. > > Thanks > George--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If I do that then the other action that is being redirected to will have to read from flash sometimes and sometimes just use params. I really want to redirect to it as if I was coming from the search screen... G. On Jul 25, 10:56 am, tmac <mcintyre....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try out the flash: > > flash[:client_search] = params[:client_search] > > they should then be available in the flash to the next controller > instance invoked by the redirect. > > good luck > Tim > > On Jul 24, 3:24 pm, giorgio <george.pever...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have a simple client search screen that posts the following params: > > > Parameters: {"search"=>"Search", "action"=>"list", > > "client_search"=>{"first_name"=>"jane", last_name"=>"smith"}, > > "controller"=>"client"} > > > This works fine. However I want to redirect to the same destination to > > do the search without the intervening screen. > > I have used the code: > > redirect_to :action=>"list", :client_search=>{:first_name => > > "jane",:last_name=>"smith"} > > > This does not work.. the parameters appear as: > > Parameters: {"action"=>"list", > > "client_search"=>"last_namesmithfirst_namejane", > > "controller"=>"client"} > > > ie it is not nesting the "client_search" hash and I get the following > > error when trying to update the attributes on the client_search table > > using these params: > > NoMethodError (undefined method `stringify_keys!'' for > > "last_namesmithfirst_namejane":String): > > E:/RailsApps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ > > active_record/base.rb:1668:in `attributes='' > > E:/RailsApps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ > > active_record/base.rb:1591:in `update_attributes'' > > > Can anyone tell me what I am doing wrong and how to get around the > > problem. > > > Thanks > > George--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---