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
Interference between Marketable Pages & ActiveStorage (Rails 5.2) #3383
Comments
Hi @Obi-TOB ! Thanks for you bug report! We do not use ActiveStorage so we did not see this bug, did you tried to add the keys https://github.com/refinery/refinerycms/blob/master/pages/lib/refinery/pages/configuration.rb#L64 |
Hi @bricesanchez! I tried this:
bit it did not help. I would think these I think this is more an ActiveStorage issue than a refineryCMS issue. See rails/rails#31228 Although I do not think that a route constraint is a good solution, however I don't see that anyone has come up with a better solution so far, so if you want me to prepare a pull request I can do so. |
It's also used in this method refinerycms/pages/lib/refinery/pages/engine.rb Lines 56 to 66 in 911cde3
@parndt Could you help us to understand how this method works, it's pretty hard to understand and i'm not sure if it still works? :D |
That method is pretty complex, huh? But it isn't anything to do with this. The method you're after is this one: refinerycms/pages/lib/refinery/pages/engine.rb Lines 49 to 53 in 911cde3
|
I would say that the best way to fix this is to add constraints like @Obi-TOB recommends. Maybe it can be constraints: -> { |request| !request.env['REQUEST_URI'].start_with?('/rails/active_storage') } |
What might also work is mounting Spree after Refinery as, from memory, in a routes file the routes that are declared last override routes declared before that point. However, that won't fix our underlying issue. What we could also do is expose a configuration value in pages config like:
Then we can use it like this: constraints: -> { |request| !Refinery::Pages.config.reserved_paths.any? { |path| request.env['REQUEST_URI'].start_with?(path) } } |
Also see this rails/rails#31228 (comment) |
Hi @parndt, thanks for your answers! I like to add @Obi-TOB Would you like to provide a Pull Request? |
RefineryCMS (with Rails 5.2. support) in combination with SpreeCommerce 3.6.2:
When mounting Refinery in root
marketable_page routes interfere with ActiveStorage, i.e. the Refinery route matches and Refinery::PagesController takes over request:
I'm not really sure why this happens as the ActiveStorage routes are above the Refinery routes:
Removing the mount point for Refinery or moving it to a different path however resolves the issue.
I resolve this now by a hacky route constraint in Refinery, however I would be interested why this happpens and how to resolve it 'right'.
The text was updated successfully, but these errors were encountered: