I'm creating a new plugin for a jruby on rails application that will eventually be turned into a gem. Inside my plugin I have controllers, helpers and views. For my views I'd like to use Haml. The problem is that I can't seem to get it to recognize that they are haml templates. Is it even possible to do this? Is there a way for a plugin to have Haml as a dependency for its view? And by that I mean, I intend for the plugin that I'm creating to have a view created by the plugin, that can be used by the application developer.
for example:
vendor/
plugins/
my_plugin/
lib/
app/
views/
my_plugin_demo/
index.haml.html
controllers/
my_plugin_demo_controller.rb
helpers/
In my plugin's init.rb, I tried:
require 'my_plugin'
require 'haml' #doesn't seem to make a difference :(
but that didn't seem to make any difference. Has anybody had any experience with this? I can't seem to find any documentation on how to make this work. Are plugin views restricted to .erb templates?
Update: @Jens Fahnenbruck
I'm a still a bit confused... are you recommending that I place the following into my_plugin's init.rb file?
# Load Haml and Sass.
# Haml may be undefined if we're running gems:install.
Haml.init_rails(binding) if defined?(Haml)
require 'my_plugin'
I tried doing just that and it didn't work. its still giving me the following page error:
Missing template my_plugin_demo/index.erb in view path app/views
Not sure I understand what you were recommending...