ergoserv / auxiliary_rails_resourceable

AuxiliaryRails::Resourceable module speeds up development by loading your controllers with RESTful (CRUD) actions.
MIT License
2 stars 0 forks source link

Singular Resources support #1

Open stgeneral opened 2 years ago

stgeneral commented 2 years ago

Add support or just a description for using https://guides.rubyonrails.org/routing.html#singular-resources.

stgeneral commented 1 year ago

Solution:

# config/routes.rb
resource  :org, only: [:show]

# app/controllers/orgs_controller.rb
class OrgsController < ResourcesController
  private

  def find_resource
    id_param.present? ? super : current_user.org
  end
end