Google Groups

Re: [Rails-core] ActiveRecord conditions: Symbol or String

Jon Leighton Apr 20, 2012 4:30 AM
Posted in group: Ruby on Rails: Core
On 20/04/12 12:21, Dmytrii Nagirniak wrote:
>>> Hi,
>>> A quick question: in the query `Company.where(:status =>  :active)`, is it OK to use the symbol (:active) as a value in the query?
>>> It definitely works with no issues at all.
>> I'm not sure I'd consider it a public stable API, but if it works, go wild :).
> So it is not a public API and the symbols were not supposed to be used this way? RIght?

It's not really good Ruby style. See

However I think we'd probably have to add specific code to make it *not*
work, so it will probably continue to work in the future. But I wouldn't
recommend doing it.