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 %>
<%= 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.


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
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment