Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module support on relations #81

Open
jwright opened this issue Aug 23, 2013 · 2 comments
Open

Module support on relations #81

jwright opened this issue Aug 23, 2013 · 2 comments

Comments

@jwright
Copy link

jwright commented Aug 23, 2013

Namespacing your models with modules is not currently supported.

For example:

module GIJoe
  class Enemy
  end
end

module GIJoe
  class SnakeEyes
    has_many :enemies
  end
end

This results in an error with an undefined constant enemy.

Suggested fix

The column class should not assume Object.const_get and can use the classes module or loop through the modules specified in :as and :joined_class_name using the camelize method of specifying modules (e.g. gi_joe/enemy)

module GIJoe
  class Enemy
  end
end

class SnakeEyes
  has_many :enemies, joined_class_name: 'gijoe/enemy'
end
@sxross
Copy link
Owner

sxross commented Aug 24, 2013

Can you get a PR together for this?

@jwright
Copy link
Author

jwright commented Aug 25, 2013

Yep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants