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

ActionMailer preview routes get clobbered by a globbing route #17895

Closed
GBH opened this issue Dec 3, 2014 · 2 comments · Fixed by #17896
Closed

ActionMailer preview routes get clobbered by a globbing route #17895

GBH opened this issue Dec 3, 2014 · 2 comments · Fixed by #17896

Comments

@GBH
Copy link
Contributor

GBH commented Dec 3, 2014

I think it should be prepend and not append.

If application has a globbing route like

get '*path', to: 'foo#bar'

preview routes become inaccessible

@jcutrell
Copy link
Contributor

jcutrell commented Dec 6, 2014

Perhaps the correct fix would be:

if options.show_previews
          app.routes.append do
            get '/rails/mailers'         => "rails/mailers#index"
          end
          app.routes.prepend do
            get '/rails/mailers/*path'   => "rails/mailers#preview"
          end
        end

But that feels wrong too.

@GBH
Copy link
Contributor Author

GBH commented Dec 7, 2014

Anything you add with append will not be accessible if app has globing route.
*path basically means everything. Nothing gets past this.

I made pull request with the fix there.

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

Successfully merging a pull request may close this issue.

2 participants