NoBrainerORM / nobrainer

Ruby ORM for RethinkDB
http://nobrainer.io/
Other
387 stars 49 forks source link

Allow string keys for where attribute keys #158

Closed robertjpayne closed 9 years ago

robertjpayne commented 9 years ago

I'm not sure the best way to go about this, but I'm attempting to not use fat arrows but NoBrainer's query syntax sometimes requires them:

Works: .where(:id.in => ['1'] Doesn't Works: .where('id.in': ['1'])

Would it be a overly hard to allow such a change? I know it'd involve detecting string keys and converting them to symbols first.

I may attempt a PR :)

robertjpayne commented 9 years ago

Also totally understand if this is not plausible, I just had a dig through the code and it looks like it may be difficult to allow such a thing.

nviennot commented 9 years ago

It's not possible to use :. You can do this: .where(:id.in ['1']) (omit the =>).

edit: typo

nviennot commented 9 years ago

You can also do .where(:id.in(['1'])) (with parenthesis)

robertjpayne commented 9 years ago

Perfect, thanks!