-
Notifications
You must be signed in to change notification settings - Fork 2k
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
res.view()
fails to render views nested more than 2 folders deep
#3604
Comments
Nice catch, and sounds like a plan. Only thing I'd add is that the original point of the two-level-specific view path logic was added to support the use case of using |
This is all handled in |
Also uses `_.get` to allow for deeply nested views in view syntax, e.g. `/foo: {view: 'foo/bar/baz'}` refs #3604
Closed by #3617 |
See #3682 for follow-up on this. The issue was that (1) options needed to get passed through and (2) the target dictionary needed to get merged into the options dictionary. The first thing will always be something hook authors have to look out for-- the latter can be dealt with in the router itself (since its only relevant for core options like skipAssets and skipRegex-- other options are fine). For now, blueprints, controllers, and views hook all manage the merging of |
See http://stackoverflow.com/questions/35637450/routes-in-sails-js-0-12-1
If you have a view in say
views/app/user/homepage.ejs
, and a route inconfig/routes.js
like:and try to hit
/user
in a browser, Sails will attempt to displayapp/user
(and fail because it doesn't exist) instead of displayingapp/user/homepage.ejs
.The issue is in this code which only parses view expressions two levels deep. However, because of a previous bug in 0.11.x that was patched in 0.12, this behavior actually worked in 0.11 (the bug prevented req.options from overriding options that were initially bound with the handler, so this code had no effect and the correct view path got sent to
res.view()
).We can solve this by using Lodash
_.get()
to parse the view expression instead of just taking the top-level and second-level view names.The text was updated successfully, but these errors were encountered: