Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you namespace the default dossier route? #50

Open
cullepm3 opened this issue Dec 30, 2014 · 3 comments
Open

Can you namespace the default dossier route? #50

cullepm3 opened this issue Dec 30, 2014 · 3 comments

Comments

@cullepm3
Copy link

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}
@ezraball
Copy link

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.

@mooreds
Copy link

mooreds commented Jun 21, 2016

@ezraball @cullepm3 did y'all find any path forward?

@ezraball
Copy link

ezraball commented Jul 8, 2016

I never ended up using this gem, @mooreds .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants