Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get my dummy app to use the Engine's template engine?

I have a Rails Engine I'm working on and the gemspec has this:

s.add_development_dependency "rspec-rails"
s.add_development_dependency "combustion"
s.add_development_dependency "capybara"
s.add_development_dependency "factory_girl_rails"
s.add_development_dependency "ffaker"
s.add_development_dependency "draper"
s.add_runtime_dependency "sqlite3"
s.add_runtime_dependency "slim-rails"
s.add_runtime_dependency "sass-rails"
s.add_runtime_dependency "jquery-rails"
s.add_runtime_dependency "rails", "~> 3.2"

However upon going to the correct controller/action I get this error:

Missing template countdown/subscriptions/index, countdown/application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in: * "/Users/krainboltgreene/Repository/ruby/countdown/spec/dummy/app/views" * "/Users/krainboltgreene/Repository/ruby/countdown/app/views"

Notice the handlers part?

like image 447
krainboltgreene Avatar asked Dec 09 '22 03:12

krainboltgreene


2 Answers

You should require the gem in lib/your_engine.rb. If you only require it in your dummy app's config/application.rb, then others are going to have this same problem when include your engine in their apps.

This can be especially confusing because in regular Rails app development. It's easy to rely on Bundler.require to load all of your gems for you.

http://myronmars.to/n/dev-blog/2012/12/5-reasons-to-avoid-bundler-require

like image 89
Hannah Christine Deffenbaugh Avatar answered Dec 28 '22 06:12

Hannah Christine Deffenbaugh


I had a similar problem with the dummy application not loading Devise. What I had to do was require it inside config/application.rb and then it worked. Perhaps you just need to require 'slim' there and it will work too?

like image 33
Ryan Bigg Avatar answered Dec 28 '22 06:12

Ryan Bigg