String “true” and “false” to boolean

前端 未结 13 826
青春惊慌失措
青春惊慌失措 2020-12-08 18:23

I have a Rails application and I\'m using jQuery to query my search view in the background. There are fields q (search term), start_date, end

13条回答
  •  失恋的感觉
    2020-12-08 18:49

    You can use wannabe_bool gem. https://github.com/prodis/wannabe_bool

    This gem implements a #to_b method for String, Integer, Symbol and NilClass classes.

    params[:internal].to_b
    

提交回复
热议问题