> Well, with my method it seemed like it was needed.
That's right but how can your engine know what helpers are not tied to
controllers ? mmmhh, that's definitely doable but it's not worth it.
> I tryed your way, but it doesn't seem to work.
I think that's because of namespacing. It expects Admin::MediasHelper
but that's weird since you call it from your Admin module.
Maybe you should try to force it ?
ActionController::Base.helper "admin/#{File.basename(file, '.rb')
".camelize.constantize
I'm thinking, maybe you could have the best of the two worlds.
%w{metas categories themes}.each do |name|
ActionController::Base.helper
"Admin::#{name.camelize}Helper".constantize
end
What do you think about it ?
>
> /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/inflector/methods.rb:103:in
>
> `constantize': uninitialized constant MediasHelper (NameError)
>
> Even when I add the loadpaths
>
> module Admin
> ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__) +
> "/../app/helpers"
> Dir[File.dirname(__FILE__) +
> "/../app/helpers/**/*_helper.rb"].each do |file|
> ActionController::Base.helper File.basename(file,
> '.rb').classify.constantize
> end
> end
>
>
>
> Didier Did wrote:
>> Your solution looks good ! Are you sure that even your first statement
>> (ActiveSupport::Dependencies.load_paths...) is needed ?
>>
>>
>>> What I'm woundering now is if It's possible to load all helpers without
>>> specifying them individualy
>>
>> Something like that ?
>>
>> module Admin
>> # adjust path
>> Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do
>> |file|
>> ActionController::Base.helper File.basename(file,
>> '.rb').classify.constantize
>> end
>> end
--
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