Setup rabl with rails engines
Clone this wiki locally
There have been a few issues with RABL integrated into a Rails Engine. Check out the primary issue here.
In short, RABL does not appear to be loaded properly when the dependency stems from an engine. To fix this you can add an explicit require in initializers:
# config/initializers/rabl.rb require 'rabl'
or add rabl to your application Gemfile:
# Gemfile gem 'rabl'
If you still get Cannot find rabl template errors when e.g. using Rails Engines in Rails 3.x, use this code to help Rabl find the views:
# config/initializers/rabl.rb require 'rabl' Rabl.configure do |config| Dir['engines/*'].each do |name| name = name.sub('engines/', '') path = Rails.root.join('engines', name, 'app', 'views') config.view_paths << path end end
Note that the Rails engines are stored under the Rails root directory, e.g. engines/my_engine_name.
If you have any other information regarding engines and RABL, please add that here.