I just upgraded my project to rails 4 and i'm getting an error on this line :
Group.first.event_joins.order(event: [:threshold]).reverse
This line should select the event_joins and order them by threshold. The threshold column is in the event table not in the event_joins table. I would like to like to order the event_joins by event treshold. How can I write this in rails 4 ?
The error :
ArgumentError: Direction "[:threshold]" is invalid. Valid directions are: [:asc, :desc, :ASC, :DESC, "asc", "desc", "ASC", "DESC"]
Thanks
This should work:
Rails 4 supports hash arguments, eg
order(model: :asc)
but i have no idea how to make it work through associations.