Putting a controller into a gem?

If I put a controller class into a gem, and then require that gem in my application, will the controller then be available to handle requests?

I'm designing a controller that I think could be useful for more than one project, so I was thinking I would develop it separately and create a gem for my main project to use. However, I don't know much about gems yet, so I'm not sure if this would work.      --Paul

Well it can be done from a plugin, you just need to add the folder containing your models to $LOAD_PATH, Dependencies.load_paths and config.controller_paths (where config is the object in the initializer block in environment.rb). My controller wasn't rendering any views (just json) but If you were you'd probably need to fiddle around with view paths. With any luck you'll be able to massage this into working with a gem too.

Fred