Recourse
Provides a new recourses method that can be invoked in a Rails app inside config/routes.rb
recourses is like resources on steroids for admin-only routes:
- All the routes are included in
Recourse.resourcesto easily display in a navbar - Their controllers do not need to define the
indexaction: they inherit a predefined one - There is also a predefined
index.htmlview which displays the resources paginated/searchable. - The content of each row can be customized defining a new
_row.html.erbpartial
How to install
- Add
gem 'recourse'to theGemfilefile of your Rails app.
Available methods
In config/routes.rb:
recoursesinside the routes
In a resourceful Active Record model:
recourse_includes: the associations to include when fetching the resourcesrecourse_order: the SQL to sort the resources by
Anywhere:
Recourse.resourcesto list all the routes