pushtype / push_type

PushType is a modern, open source content management system for Ruby on Rails.
http://www.pushtype.org
Other
290 stars 32 forks source link

Fix conflicts with apps using multiple engines #50

Open ashervb opened 6 years ago

ashervb commented 6 years ago

If routes are being pulled in via another Engine, the map_app.url_for can fail resulting in a ActionController::UrlGenerationError error

aaronrussell commented 6 years ago

Hi thanks for the PR, and sorry for keeping you waiting.

I currently can't merge this. The patch was originally introduced so that kaminari could be used in both pushtype and the main app - discussed here kaminari/kaminari#322. I think your PR will reintroduce that issue.

It seems what we actually need is something like:

begin
  @template.push_type_admin.url_for arguments
rescue
  begin
    base_page_url_for(page)
  rescue
    @template.main_app.url_for arguments
  end
end

... even if that is the ugliest code I've ever written :trollface: I'm open to any suggestions, just need to make sure all bases are covered. Also need to be mindful that kaminari are apparently working on a refactor that will change all this.