Rails Plugins Load Path - I have ActiveRecord Models in a Plugin, How do I load them without Namespa

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-05-10T04:39:22Z Indexed on 2010/05/10 4:48 UTC
Read the original article Hit count: 270

I have a bunch of models for Oauth services, things like:

  • TwitterToken
  • GoogleToken

There are OAuth versions and OpenID versions for some, so I decided to logically organize my gem like so:

lib
lib/my-auth-gem
lib/my-auth-gem/oauth
lib/my-auth-gem/oauth/tokens/google_token
...
lib/my-auth-gem/openid/tokens/google_token
...

I would like to be able to name my models GoogleToken, rather than MyAuthGem::Oauth::Tokens::GoogleToken. How do I do that?

This will be for Rails 2.3+ and Rails 3.

© Stack Overflow or respective owner

Related posts about rubygems

Related posts about loadpaths