check_box_tag and find condition
Posted
by red
on Stack Overflow
See other posts from Stack Overflow
or by red
Published on 2010-04-06T06:08:15Z
Indexed on
2010/04/06
6:13 UTC
Read the original article
Hit count: 131
ruby-on-rails
<%= check_box_tag('videos_count')%>
If this box is checked, the param will say "videos_count"=>"1" . In the controller I have this:
videos_count = params[:videos_count]
@cars = Car.paginate( :page => params[:page], :per_page => 10,
:conditions => ["videos_count = ?", videos_count],
when the box is checked I see the correct parameter in the server log, but the find returns all of the results instead of results with videos_count = 1.
© Stack Overflow or respective owner