\"1\" .In the controller I have this:" />
开发者

check_box_tag and find condition

开发者 https://www.devze.com 2022-12-26 00:10 出处:网络
<%= check_box_tag(\'videos_count\')%> If this box is checked, the param will say \"videos_count\"=>\"1\" .In the controller I have this:
  <%= 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 re开发者_如何学运维turns all of the results instead of results with videos_count = 1.


Check the datatype of 'videos_count' if it's Tiny INT then following may worh. No checked though.

:conditions => ["videos_count = ?", true] 


What will the output for this?

:conditions => ["videos_count = ?", 1])

I think there is an issue with your table.

0

精彩评论

暂无评论...
验证码 换一张
取 消