My application uses a License model which has_many Libraries, which, in
turn, has_many Books. A user has a License associated with their account
that should allow them to see the Books included in their licensed Library.
I have this in the Books controller:
def index
filtered_books = Book.apply_scopes(
...
)
hobo_index filtered_books.published.licensed_to(current_user)
end
but it is throwing this error when I try to load the index: undefined method
`default_order' for []:Array
in Book.rb, we have:
def self.licensed_to(user)
user.accessible_libraries.*.books
end
This returns an Array, for which default_order is not defined. Here is the
accessible_libraries method in User.rb:
def accessible_libraries
self.user_licenses.active.*.libraries
end
So my problem is: How can I either avoid the default_order call in
hobo_index or refactor this so that I can pass something to hobo_index that
responds to default_order instead of a plain Array? Any advice would be much
appreciated. Thanks!
Jim
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/QkdlANxDkN0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.