> could you tell me how to include those helpers from my engine? I have
> tried several methods like
>
> class Engine < Rails::Engine
> config.to_prepare do
> ApplicationController.helper(Admin::MetasHelper)
> end
> end
>
I spent some much time on this, trying all the different ways of
including those helpers (ie not related to controllers), without any
success (sometimes it worked in dev env but not in prod, ...etc).
So I came up with another approach.
Actually, my engine controllers inherit from a base controller. So
inside this base one, I added the following lines:
Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do
|file|
helper "admin/#{File.basename(file, '.rb').gsub(/_helper$/, '')}"
end
Even if it is not super clean, it does the trick for me. If anyone has a
better way of doing it, let me know :-)
> Secondly, I allready knew that accessing assets from gems would be
> impossible. The only difference was, that I thought that their might be
> a special helper like the rails_engine plugin for Rails 2.x .
> But just for the info, how do I access files from my gem/engine? When I
> create a generator, how does the filepath usualy work?
Take a look at my generator:
http://github.com/did/locomotive/blob/master/lib/generators/locomotive/assets/assets_generator.rb
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Engine-Users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org