Rails - order by joint attribute -
i upgraded project rails 4 , i'm getting error on line :
group.first.event_joins.order(event: [:threshold]).reverse this line should select event_joins , order them threshold. threshold column in event table not in event_joins table. like order event_joins event treshold. how can write in rails 4 ?
the error :
argumenterror: direction "[:threshold]" invalid. valid directions are: [:asc, :desc, :asc, :desc, "asc", "desc", "asc", "desc"] thanks
this should work:
group.first.event_joins.order('events.threshold').reverse rails 4 supports hash arguments, eg order(model: :asc) have no idea how make work through associations.
Comments
Post a Comment