My views directory is structured as follows:
view
Is there a way to render the partial from apply.html.haml without specifying the full path?
I read somewhere else I could do render :partial => "./nav/menu"
but it isn't working for me.
Use the full path in the render method.
For example, if you have the following directory structure ...
app
| views
|--» landing
|----» main_template.html.erb
|----» desktop
|------» _home.html.erb
|----» mobile
|------» _home.html.erb
... and main_template
which calls render is found underapp/views/landing
, then calls to render would look like this ... render partial: 'landing/desktop/home'
render partial: 'landing/mobile/home'
You can use append_view_path
in your controller. I use it like that:
class DemoController < SiteController
.
.
before_filter do
append_view_path Rails.root.join("domain/domain1/user_mailer")
end
...
Of course this only works if you have different view/partial names in these directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With