I try to get haml working without the gem with sinatra (Heroku doesn't allow gem install, as far as I know)
What I've done so far:
clone the haml git repo inside my project
add : require 'haml/lib/haml.rb' to my sinatra main file
the following works:
get '/test' do
Haml::Engine.new('%p test').render
end
but the following doesn't:
get '/test2' do
haml :my_template
end
I get the error :
NoMethodError - undefined method each' for nil:NilClass
(haml):20:in
render'
./haml/lib/haml/engine.rb:152:in `render'
./haml/lib/haml/engine.rb:152:in `instance_eval'
./haml/lib/haml/engine.rb:152:in `render' ...
Is there any other files to require ? Any ideas ?
Heroku supports installing gems by creating a .gems
file in your project's root directory and adding it to Git. On your next push the gems required in there will be installed. To install Haml the file would contain this line:
haml --version '>= 2.2.0'
More information can be found here: http://docs.heroku.com/gems
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