Ruby on Rails Friday, January 31, 2014


On Friday, January 31, 2014 10:15:08 AM UTC, Marie Bellec wrote:

I don't think the problem comes from contôler and raw_counter,
because when I replace : 
<%= form_tag '/counters/id', method: :get %>
by: 
<%= form_tag '/counters/ovm%3Ab%3A%7Bpausecho%7D%2Fmozilla', method: :get %>

That's because your controller is looking for params[:id], but your form tag is always setting it to 'id' (because the url is /counters/id), which presumable results in redis returning nil. (The value of your search field is in params[:counters])

It might also be prudent to check what is returned from redis before using it.

A form can't change the path submitted to based on the fields submitted, so you either have to have some dummy value (if you want it to go to the show action), or else let it go to the index action, but if the :counters parameter is present, indicating that a search is being requested, then redirect to the appropriate show page.


Fred
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed8d6612-fa98-470a-971e-2429bc1f2568%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment