Using a controller to initiate a plugin?

Folks I am new so I apologize if I come off as a totaly tool. I am
finding Rails to be an amazing framework to use and having fun with it.
I have run into a frustrating snag however with PLUGINS.

I have a plugin installed in: /myapp/vendor/plugins/
When I run: ruby script/server in /myapp/ my WEBrick starts normally and
I can access IP:3000. I get the default rails index page.

How do I “enable” the plugin? How do I tell the app to use it? I try to
access the directories and I just get 404 not founds so obviously I am
not doing it correctly.

Insight and advice greatly appreciated.

Update:
When I access anything on the server now (index.html) the default rails
page I get this:

#<NoMethodError: undefined method clear!' for Controllers:Module> ["/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:53:inreset_application!’",
“/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:75:in
reset_after_dispatch'", "/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:46:indispatch’”,
“/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:in
handle_dispatch'", "/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:inservice’”, “/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service'", "/usr/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’”,
“/usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread'", "/usr/lib/ruby/1.8/webrick/server.rb:162:instart_thread’”,
“/usr/lib/ruby/1.8/webrick/server.rb:95:in start'", "/usr/lib/ruby/1.8/webrick/server.rb:92:instart’”,
“/usr/lib/ruby/1.8/webrick/server.rb:23:in start'", "/usr/lib/ruby/1.8/webrick/server.rb:82:instart’”,
“/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:in
dispatch'", "./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:59", "/usr/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’”,
“./script/…/config/…/vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in
`require’”,
“./script/…/config/…/vendor/rails/railties/lib/commands/server.rb:39”,
“script/server:3”]

I have no idea what this means…

Brad wrote:

Folks I am new so I apologize if I come off as a totaly tool. I am
finding Rails to be an amazing framework to use and having fun with it.
I have run into a frustrating snag however with PLUGINS.

I have a plugin installed in: /myapp/vendor/plugins/
When I run: ruby script/server in /myapp/ my WEBrick starts normally and
I can access IP:3000. I get the default rails index page.

How do I “enable” the plugin? How do I tell the app to use it? I try to
access the directories and I just get 404 not founds so obviously I am
not doing it correctly.

Insight and advice greatly appreciated.

Anyone have any ideas? :frowning:

Normally, you don’t have to do anything to ‘enable’ a plugin; when
Rails starts up, the plugin’s init.rb file will be evaluated, and the
plugin should do anything it needs at that point.

Using a plugin depends from each to the next. Some provide new syntax
or macro-esque methods that you can use in your controllers or models,
in which case the plugin will probably do nothing until you make use
of those features in your code.

Which plugin is it that you’re trying to use?

  • james

Hey Brad -

each plugin does it’s own thing, and so your question is a little
too generic.

but you can count on needing a model/controller/view to use the
plugin. The plugin will be generally activated by the Model - such as

class Machine < ActiveRecord::Base
acts_as_state_machine :initial => :idle

state :idle
state :running, :enter => Proc.new { |o| o.stop_timer(‘idle’);
o.do_work() }

etc.

This is how I ‘use’ the act_as_state_machine plugin.

see the plugins docs for instructions on how it is specially used.

enjoy the journey!
Jodi