Skip to content

Instantly share code, notes, and snippets.

@jasonayre
Created February 20, 2015 21:07
Show Gist options
  • Save jasonayre/6f5783dd22b964cf53d9 to your computer and use it in GitHub Desktop.
Save jasonayre/6f5783dd22b964cf53d9 to your computer and use it in GitHub Desktop.
def self.mounted_path_for_engine(engine_klass)
route = ::Rails.application.routes.routes.detect do |route|
route.instance_variable_get("@app").instance_variable_get("@app") == engine_klass
end
route && route.instance_variable_get("@path_formatter").instance_variable_get("@parts").join("")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment