How do I use Haml in a view in my new plugin?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-06-07T10:40:45Z Indexed on 2010/06/07 11:42 UTC
Read the original article Hit count: 155

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?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rubygems