I have this code in init.rb of a test plugin, but it does not make my controller work that I have inside the plugin. I''m not sure what else to try, this seems to be a recommended approach I found on various tutorials. %w{ controllers }.each do |dir| path = File.join(File.dirname(__FILE__), ''lib/app'', dir) $LOAD_PATH << path ActiveSupport::Dependencies.load_paths << path ActiveSupport::Dependencies.load_once_paths.delete(path) end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
if I add this it seems to work: config.controller_paths << path this guide (below) seems to advocate doing a require from init.rb, but config.controller paths would have to be passed as it is not visible elsewhere it appears: http://guides.rubyonrails.org/plugins.html#working-with-initrb On Jan 26, 11:38 am, Jedrin <jrubia...@gmail.com> wrote:> I have this code in init.rb of a test plugin, but it does not make my > controller work that I have inside the plugin. I''m not sure what else > to try, this seems to be a recommended approach I found on various > tutorials. > > %w{ controllers }.each do |dir| > path = File.join(File.dirname(__FILE__), ''lib/app'', dir) > $LOAD_PATH << path > ActiveSupport::Dependencies.load_paths << path > ActiveSupport::Dependencies.load_once_paths.delete(path) > end-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Michael Koziarski
2010-Jan-26 20:10 UTC
Re: Re: controllers inside plugin do not work for me
>> I have this code in init.rb of a test plugin, but it does not make my >> controller work that I have inside the plugin.Your plugin controllers can''t really subclass ApplicationController or any other application components as they''ll get reset each request in development mode. If a plugin wants to include a controller it''ll have to subclass ActionController::Base directly or, as your snippet does, make that controller reload each request. -- Cheers Koz -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.