Project

recourse

0.0
The project is in a healthy, maintained state
Turns resources into recourses
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

>= 0
>= 0
 Project Readme

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.resources to easily display in a navbar
  • Their controllers do not need to define the index action: they inherit a predefined one
  • There is also a predefined index.html view which displays the resources paginated/searchable.
  • The content of each row can be customized defining a new _row.html.erb partial

How to install

  1. Add gem 'recourse' to the Gemfile file of your Rails app.

Available methods

In config/routes.rb:

  • recourses inside the routes

In a resourceful Active Record model:

  • recourse_includes: the associations to include when fetching the resources
  • recourse_order: the SQL to sort the resources by

Anywhere:

  • Recourse.resources to list all the routes