-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting on "virtual" column #2468
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use the money-rails gem which basically has me store values in terms of cents. For instance, if I wanted to represent a price of $10.00, I could create a column called
price_cents
and write1000
to it. Monetize is great because when you call.price
, you get back the price in dollars (in this case, 10).When I'm using a monetize column in Administrate, I add in the virtual property called
price
. Everything works great, but unfortunately, the order mechanic doesn't work. Based on a quick read of the code, it seems like it expects the column to actually exist.I could switch to just displaying
price_cents
in the Administrate dashboard, but then I have to manually format everything into dollars and add translations to change the table header names. Seems unideal.Does anyone else have this problem? Any workarounds?
One solution I thought of would be to introduce an :order_by property where I could pass it a different column to sort by. Maybe something like this:
Is there an easier way to achieve what I want?
The text was updated successfully, but these errors were encountered: