Rails, Devise: Same resource, different controller based on user type
问题 I have a resource, say Product , which can be accessed by two different user classes: say Customer and Admin . There is no inheritance between these two. I am using Devise for authentication: # config/routes.rb devises_for :customers deviser_for :admins I have these two controllers: # app/controllers/customers/products_controller.rb class Customers::ProductsController < ApplicationController and # app/controllers/admins/products_controller.rb class Admins::ProductsController <