MotionModel
MotionModel copied to clipboard
Module support on relations
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
Can you get a PR together for this?
Yep.