I’m working on a library similar to acts_as_taggable. I’d like it to be
simple, one file drop-in: i.e., put my_library.rb into RAILSROOT/lib/
have everything work. However, the library requires a controller to
some stuff, so I need to be able to create the controller class, set the
routing, and extend the controller at run-time from within
I have code that creates and extends the controller properly; I’ve
that it works via the console. However, the code that I have in place to
a route to connect a url to the extended methods in the controller
seem to take effect. When testing via the webrick server, I get an
unrecognized route error.
What I have in my_library.rb is something like the following:
say I’ve generated the following controller from within my_library.rb:
class ASampleController < ActionController::Base
render_text “hello world!”
and also from within my_library.rb I have the following code to add a
:controller => ‘ASampleController’, :action => :model_name.to_s
However, the route doesn’t seem to be put in place, or even recognized.
examine ActionController::Routing::Routes from within the console, my
does not show up. When I attempt to browse to the appropriate url, I get
following in log/development.log:
Does anyone have any suggestions as to how I could go about getting the
route recognized? Any help is greatly appreciated.