Conversion between types is fairly common in Ruby. With that said I'd recommend you look into `ActiveModel::Type::Boolean.new.cast(my_value)`, which handles the all cases above.
On Mon, Apr 4, 2016 at 10:31 AM, Greg Navis <[email protected]> wrote: > Hey! > > I think this would cause confusion. First, the logical values of `string` > and `string.to_bool` would be different. Second, what would you return for > a string "foobar"? > > Best regards > -- > Greg Navis > I help small software companies to scale Heroku-hosted Rails apps. > Free, biweekly scalability newsletter for SaaS CEOs > <http://www.gregnavis.com/newsletter/> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- Wael Khobalatte -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
