bithavoc / multilang-hstore

Multilang is a small library for translating database values for Rails 4 and Postgresql hstore
MIT License
41 stars 18 forks source link

Is there a way to search translated attributes in any language? #2

Open pilap82 opened 11 years ago

pilap82 commented 11 years ago

Hi,

let's say I have a translated name column.

Post.where(name: 'youpi')

doesn't work.

Is there a way to look for any post whose name is 'youpi' in any of the locales (without having to duplicate the conditions for each locale)?

thanks, P.

seuros commented 10 years ago

Yes. you can use the avals(hstore) for that

see more at : http://www.postgresql.org/docs/9.0/static/hstore.html