Rails Custom Plugin/Gem with Partials
Posted
by Jason
on Stack Overflow
See other posts from Stack Overflow
or by Jason
Published on 2010-06-10T14:20:10Z
Indexed on
2010/06/10
14:22 UTC
Read the original article
Hit count: 370
I am writing a gem which provides helpers for views. The HTML I want to insert via the helper is complex enough that I'd rather write it in a _partial.html.erb file. How do I get the gem's view path include in the application's load_path?
Note: the only gem I've found that does something like this is Devise. When a view cannot be found, Rails prints the load path which (on my machine) looks like:
Missing partial sortable_nested_set/tree with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/home/jason/VirtualRestaurant3/app/views", "/home/jason/.rvm/gems/ruby-1.9.2-preview3/gems/devise-1.1.rc0/app/views"
How does Devise do it?
My gem: http://github.com/jrmurad/SortableNestedSet Devise gem: +http://+github.com/plataformatec/devise
© Stack Overflow or respective owner