rabl: Templates not found in view path
So I have my template in a namespaced Engine
app/views/scheduler/schedules/show
Rabl::Renderer.new(
'schedules/show',
@schedules,
view_path: 'app/views/scheduler',
format: :json
).render
Rabl::Renderer.json(
@schedules,
'schedules/show',
view_path: 'app/views/scheduler'
)
Both raises this error
Cannot find rabl template 'schedules/show' within registered (["app/views/scheduler"]) view paths!
However it does work in my specs within the Engine but not when using the Engine from the parent app.
rails (3.2.8) rabl (0.7.2)
About this issue
- Original URL
- State: open
- Created 12 years ago
- Comments: 23 (7 by maintainers)
Debuging this worked for me in the controllers
render inline: Rabl::Renderer.xml(@login, “app/views/scoped_directory/logins/show”, view_path: Rails.root.to_s)
@kmalakoff, when I’ve wanted to point to paths within an engine, one approach is to create a method in the engine, that returns the path relative to the engine.
So in my_engine/lib/my_engine.rb I’d create a method like this:
Then in the host app I can add:
For example, look at active_admin_load_path here:
https://github.com/reggieb/qwester/blob/master/lib/qwester.rb
Ok, so observations so far:
'isolated_engine/nested_items/show'