-
Notifications
You must be signed in to change notification settings - Fork 5
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
Using Perspectives in an Engine #2
Comments
@emerson-h you should be able to configure the template path to whatever you want. The default railtie configures it to be Perspectives.configure do |c|
c.template_path = app.root.join('whatever', 'you', 'want')
end |
@a-warner Thanks! I saw that a couple of minutes ago as I was looking for a possible fix. It seems like it might be more robust to have the railtie default the template path to be relative to the directory of the including railtie, so for instance, if included in an engine, it would default to <engine_path>/app/mustaches/ for that engine. If you think that's a good idea, I'm happy to submit a pull request |
@emerson-h i'd love to see a pull request. the template path should be relative to the root of the including engine/app for sure. |
@a-warner I'm working on a fix for this, but so far it's proving more intractable than I hoped. A stop-gap solution is to symlink the mustaches folder from an engine into the including application. |
ugh, that's a deeply unsatisfying stop-gap though 😄 it seems like Rails probably handles this pretty well, I guess by allowing railties/engines to append to the view_paths instead of having one total view path for the app? maybe a similar solution here would make sense? (although how do you distinguish between |
I'm working on an application that uses a component based approach, so we have several engines. I would love to keep the views as dumb as possible and Perspectives seems to be a great way to do that.
The project is setup something like this:
When visiting the engine's routes in the URL (e.g.
foo_engine/bars/1/show
), perspectives raises this error:It seems like it's not recognizing that it's running within an engine, so it's looking for mustaches in the top level app folder.
The text was updated successfully, but these errors were encountered: