resources
A recourses line in config/routes.rb draws the routes, the
controllers and every view a resource needs. More convention, less configuration.
Add recourse to the Gemfile. Then edit config/routes.rb replacing resources
with recourses.
# Gemfile
gem 'recourse'
# config/routes.rb
- resources :posts, only: %i[index show] do
+ recourses :posts, only: %i[index show] do
- resources :comments, except: :destroy
+ recourses :comments, except: :destroy
end
That is the whole of what a host has to do. Everything else is optional.
indexA paginated, searchable, sortable table with a sidebar entry, a keyboard shortcut, and live reload.
showThe record’s page with properly formatted attributes (numbers with precision, currency, localized timestamps, masked secrets).
new and editA field for each column’s kind, carrying what the validators say — a length as maxlength, a format as pattern, a required attribute as a required field.
A dialog naming the record and counting what goes with it, and a page that says so rather than raising when a model will not give a row up.
Each resource nested under a record is a tab on its card, counted where the record keeps a count, and a bare action is a button beside the breadcrumb.
A table of places reads as a Google map, a table of events as a week, a table with a position is dragged into order, and one fed from elsewhere offers to fetch again.
One Proc naming the viewer’s kept rows, and every table that can hold one opens with a square to keep a row by, kept rows first.
A primary color, one of nine palettes, light or dark at the reader’s own choosing, and every time drawn in the reader’s own zone.
One page per screen, in the order a host meets them.
recourses, recourse, nesting, namespaces, and the two keywords.
ModelsThe hooks a model may answer, and what the schema says without them.
TablesColumns, sorting, searching, filters, pages, bookmarks and live refreshes.
Records and formsThe show page, the form, the card around both, and the delete.
Maps and calendarsThe same page of rows drawn on a map or as a week.
Positionable tablesRows a reader drags into an order the model keeps.
Retrievable tablesA button that fetches a table’s rows again from wherever they came.
Look and feelColor, theme, the reader’s own settings, assets and the locale.
CustomizingWhat a host writes in place of what the gem draws: views and controllers.