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

Support for namespaced model names #3

Open
pilaf opened this issue Jun 17, 2019 · 0 comments
Open

Support for namespaced model names #3

pilaf opened this issue Jun 17, 2019 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@pilaf
Copy link
Collaborator

pilaf commented Jun 17, 2019

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.

@pilaf pilaf added enhancement New feature or request bug Something isn't working labels Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant