Support for namespaced model names
Opened this issue · 0 comments
pilaf commented
Currently when using has_portal
and referencing a model in the same namespace you need to also pass :class_name
and :portal_key
manually as the gem can't figure out the Ruby namespaces. E.g.:
module App
class Family < FmRest::Spyke::Base
has_portal :member, class_name: "App::Member", portal_key: "Family_Member"
end
end
Let's also look at how ActiveRecord's relations deal with this... maybe we don't want to default :class_name
to same namespace after all 🤔
We probably do want to strip the namespace for the default :portal_key
though.
A similar thing happens with the default layout
, which currently defaults to the class name, but includes the namespace. E.g.:
module App
class Family < FmRest::Spyke::Base
end
end
App::Family.layout # => "App::Family"
We probably want it to default to the class name with namespace removed, e.g. just "Family"
in the above example.