Hi all
I want to outsource an extension for ApplicationController, that I had
in application.rb so far, into a plugin.
I have created this plugin, and in init.rb I load
require File.dirname(FILE) + ‘/lib/application_controller’
In lib/application_controller.rb I have the following code:
class ApplicationController
before_filter :prepare_user
…
end
This worked without a prolem so far.
But when I try to start Webrick now, I get the following error:
josh$ script/server
=> Booting WEBrick…
/Users/josh/Sites/projects/psyguideorg/vendor/plugins/incense_authorization/lib/application_controller.rb:4:
undefined method before_filter' for ApplicationController:Class (NoMethodError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require’
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
require’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
require’
from
/Users/josh/Sites/projects/psyguideorg/vendor/plugins/incense_authorization/lib/application_controller.rb:1
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require’
… 25 levels…
from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require’
from script/server:3
What’s wrong here? Is the ApplicationController class not loaded already
when loading the plugin?
Thanks for help
Josh