Sorry for the repost but I originally posted this as a response to another thread. I have a text field called ''phrase'' but the parameter values always come up as nil and when I check the parameters dumped in the error message I do not get the normal hash you''d expect. Instead of something like {"phrase"=>"jim"} I get: {"jim"=>"", "_"=>""} Here is the code for the form: ----------------------------------- <%= form_remote_tag(:update => "results", :url => { :controller => ''admin'', :action => :search } ) %> <!--[form:search]--> <table> <tr><td><label>search:</label></td> <td><%= text_field_tag :phrase %> <%= observe_field(:phrase, :frequency => 0.5, :update => :results, :url => { :controller => ''admin'', :action => :search }) %></td></tr> </table> <!--[eoform:search]--> <%= end_form_tag %> ----------------------------------- But I''m getting an error stating that the object is nil when it contains ''jim''. Take a look at the parameters passed. Quite odd? Shouldn''t it be {"phrase"=>"jim"}. ----------------------------------- TypeError in Admin#search cannot convert nil into String RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/models/member.rb:54:in `+'' #{RAILS_ROOT}/app/models/member.rb:54:in `search_for'' #{RAILS_ROOT}/app/controllers/admin_controller.rb:16:in `search'' Request Parameters: {"jim"=>"", "_"=>""} ----------------------------------- Any advice? - Jim
Just a wild guess...I haven''t used the observe_field method and don''t really know what it''s for but from the params you are getting it would seem the :phrase is not known. Try replacing :phrase with "phrase". Someone please correct me if I''m wrong. thanks, andy On 11/9/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote:> > Sorry for the repost but I originally posted this as a response to > another thread. I have a text field called ''phrase'' but the > parameter values always come up as nil and when I check the > parameters dumped in the error message I do not get the normal hash > you''d expect. Instead of something like > > {"phrase"=>"jim"} > > I get: > > {"jim"=>"", "_"=>""} > > Here is the code for the form: > > ----------------------------------- > <%= form_remote_tag(:update => "results", :url => { :controller => > ''admin'', :action => :search } ) %> > > <!--[form:search]--> > <table> > <tr><td><label>search:</label></td> > <td><%= text_field_tag :phrase %> > <%= observe_field(:phrase, > :frequency => 0.5, > :update => :results, > :url => { :controller => ''admin'', :action > => :search }) %></td></tr> > </table> > <!--[eoform:search]--> > > <%= end_form_tag %> > ----------------------------------- > > But I''m getting an error stating that the object is nil when it > contains ''jim''. Take a look at the parameters passed. Quite odd? > Shouldn''t it be {"phrase"=>"jim"}. > > ----------------------------------- > > TypeError in Admin#search > > cannot convert nil into String > RAILS_ROOT: ./script/../config/.. > > Application Trace | Framework Trace | Full Trace > #{RAILS_ROOT}/app/models/member.rb:54:in `+'' > #{RAILS_ROOT}/app/models/member.rb:54:in `search_for'' > #{RAILS_ROOT}/app/controllers/admin_controller.rb:16:in `search'' > Request > > Parameters: {"jim"=>"", "_"=>""} > > ----------------------------------- > > Any advice? > > - Jim > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Andrew Stone _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Nope, I have had no luck. Changing that makes no difference. In fact if I take the raw post I get ''jim&_='' so no matter what value you type in there is an ''&_='' appended to it. Any ideas as to whats going on here? - Jim On Nov 9, 2005, at 4:10 PM, Andrew Stone wrote:> Just a wild guess...I haven''t used the observe_field method and > don''t really know what it''s for but from the params you are getting > it would seem the :phrase is not known. Try replacing :phrase with > "phrase". > > Someone please correct me if I''m wrong. > > thanks, > andy > > On 11/9/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote: > Sorry for the repost but I originally posted this as a response to > another thread. I have a text field called ''phrase'' but the > parameter values always come up as nil and when I check the > parameters dumped in the error message I do not get the normal hash > you''d expect. Instead of something like > > {"phrase"=>"jim"} > > I get: > > {"jim"=>"", "_"=>""} > > Here is the code for the form: > > ----------------------------------- > <%= form_remote_tag(:update => "results", :url => { :controller => > ''admin'', :action => :search } ) %> > > <!--[form:search]--> > <table> > <tr><td><label>search:</label></td> > <td><%= text_field_tag :phrase %> > <%= observe_field(:phrase, > :frequency => 0.5, > :update => :results, > :url => { :controller => ''admin'', :action > => :search }) %></td></tr> > </table> > <!--[eoform:search]--> > > <%= end_form_tag %> > ----------------------------------- > > But I''m getting an error stating that the object is nil when it > contains ''jim''. Take a look at the parameters passed. Quite odd? > Shouldn''t it be {"phrase"=>"jim"}. > > ----------------------------------- > > TypeError in Admin#search > > cannot convert nil into String > RAILS_ROOT: ./script/../config/.. > > Application Trace | Framework Trace | Full Trace > #{RAILS_ROOT}/app/models/member.rb:54:in `+'' > #{RAILS_ROOT}/app/models/member.rb:54:in `search_for'' > #{RAILS_ROOT}/app/controllers/admin_controller.rb:16:in `search'' > Request > > Parameters: {"jim"=>"", "_"=>""} > > ----------------------------------- > > Any advice? > > - Jim > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > -- > Andrew Stone > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
&_= is a workaround for a Safari bug, and gets added by Prototype (some versions of Safari are truncating POST data on Ajax calls). Thomas Am 10.11.2005 um 07:06 schrieb Jim Jeffers:> Nope, > > I have had no luck. Changing that makes no difference. In fact if > I take the raw post I get ''jim&_='' so no matter what value you type > in there is an ''&_='' appended to it. Any ideas as to whats going > on here? > > - Jim > > On Nov 9, 2005, at 4:10 PM, Andrew Stone wrote: > >> Just a wild guess...I haven''t used the observe_field method and >> don''t really know what it''s for but from the params you are >> getting it would seem the :phrase is not known. Try >> replacing :phrase with "phrase". >> >> Someone please correct me if I''m wrong. >> >> thanks, >> andy >> >> On 11/9/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote: >> Sorry for the repost but I originally posted this as a response to >> another thread. I have a text field called ''phrase'' but the >> parameter values always come up as nil and when I check the >> parameters dumped in the error message I do not get the normal hash >> you''d expect. Instead of something like >> >> {"phrase"=>"jim"} >> >> I get: >> >> {"jim"=>"", "_"=>""} >> >> Here is the code for the form: >> >> ----------------------------------- >> <%= form_remote_tag(:update => "results", :url => { :controller => >> ''admin'', :action => :search } ) %> >> >> <!--[form:search]--> >> <table> >> <tr><td><label>search:</label></td> >> <td><%= text_field_tag :phrase %> >> <%= observe_field(:phrase, >> :frequency => 0.5, >> :update => :results, >> :url => { :controller => ''admin'', :action >> => :search }) %></td></tr> >> </table> >> <!--[eoform:search]--> >> >> <%= end_form_tag %> >> ----------------------------------- >> >> But I''m getting an error stating that the object is nil when it >> contains ''jim''. Take a look at the parameters passed. Quite odd? >> Shouldn''t it be {"phrase"=>"jim"}. >> >> ----------------------------------- >> >> TypeError in Admin#search >> >> cannot convert nil into String >> RAILS_ROOT: ./script/../config/.. >> >> Application Trace | Framework Trace | Full Trace >> #{RAILS_ROOT}/app/models/member.rb:54:in `+'' >> #{RAILS_ROOT}/app/models/member.rb:54:in `search_for'' >> #{RAILS_ROOT}/app/controllers/admin_controller.rb:16:in `search'' >> Request >> >> Parameters: {"jim"=>"", "_"=>""} >> >> ----------------------------------- >> >> Any advice? >> >> - Jim >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> -- >> Andrew Stone >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails