Skip to content

Support for namespaced model names #3

@pilaf

Description

@pilaf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions