views:

200

answers:

0

I am trying to create a plugin and use it in my project.

I created a plugin using 'ruby script/generate plugin pluginname' and added the necessary code in the rb file in lib. I added 'require File.dirname(FILE) + '/lib/pluginname' in init.rb file

I added the pluginname in my controller where I want to use it..and it throws me an exception 'undefined local variable or method pluginname'.

I also added config.plugins = [:pluginname] in environment.rb file.

I added a puts in init.rb to check if plugin is being loaded and looks like the plugin is getting loaded fine.

I restarted the webserver but still its the same.

Any idea what am I doing wrong and why are the methods in my plugin not accessible in my controller?