Relation/Sort not working in rails controller?
- by Elliot
I have the following relation in my rails app:
genre
- has many - authors
authors - belong to genre and has many books
books - belongs to authors and belongs to users
(users can add books to the db)
in my controller I have:
@books=current_user.books(:include => [:author => :genre], :order => 'created_at DESC')
While I am able to use the @books variable in my views - nothing is done correctly (i.e. its not showing me only books added by that user, and its not descending by created_at)...
any ideas?
--
Also I'm using clearance for the user auth, so current_user without the @ in the controller seems to work fine
Actually, I think the relation is working, only the sort might not be working...