awesome_hstore_translate
awesome_hstore_translate copied to clipboard
Sorting
Does the system allow for easy ordering?
eg. order(name: :asc) where name is a translated field? How well does it combine with fallbacks?
I did not see anything in the documentation, nor did I see anything in the code that would support this on first sight
Would it be hard to implement?
Thank you for creating the issue.
Sorting is not implemented, but it shouldn't be hard to do so. I'll have a look into it this weekend.
I've implemented sorting. Please check it out.
Hi,
Thanks for sorting this out (pun not intended).
Note that I have rolled out our own implementation based on JSON(B) which also implements fallbacks in sorting.
The 0.3 release breaks order
calls without a sorting direction. e.g. order(:position)
:
NoMethodError: private method `select' called for :position:Symbol
@daniel-rikowski I'll fix that in a second.
Sorry about that.
@daniel-rikowski I've pushed another version.
Probably I'll also switch over to a json solution, due it's more handy if you need to deliver json through a api anyway.
Thank you!
Symbols do work now, but combinations still do not, e.g.
Model.order(:position, id: :desc)
This results in a call like order(position: :asc, { id: :desc } => :asc }
Strings work (order('position DESC')
) but I'm not sure if that is by design or just coincidence, because there are no tests for that case.
@daniel-rikowski I'll look into it.