Can you namespace the default dossier route?
Opened this issue · 3 comments
We have an admin console that uses routes starting with 'admin'. All of the admin routes use controllers that inherit from Admin::ApplicationController. This controller has auth logic (ie. ensure_super_user).
Is it possible to configure dossier default route / controller to use a different namespace? In other words, is it possible to configure dossier's automatically created 'report' route so that it is 'admin/report' and those routes use a ReportController derived from Admin::ApplicationController instead?
I tried rolling my own, which more or less works eg:
#routes.rb
namespace :admin do
...
match 'reports/:action', :controller=>'reports', :as => :reports
class Admin::ReportsController < Admin::ApplicationController
But occasionally things don't work as expected. For instance, the options don't get passed automatically to the report. I fixed by passing params[:options] when I create the report, but it feels like I'm duplicating internal behavior. Is there a better way?
#AdminReport::Controller#referrals_report
report = ReferralsReport.new(params[:options])
render template: 'admin/reports/referrals', locals: {report: report.run}
I have the same question. If you found the answer, I'd love to know, otherwise, I'll spend some time with the source code.