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

inferring wrong representer path? #110

Closed
l8nite opened this issue Oct 2, 2014 · 1 comment
Closed

inferring wrong representer path? #110

l8nite opened this issue Oct 2, 2014 · 1 comment

Comments

@l8nite
Copy link

l8nite commented Oct 2, 2014

    44: def entity_representer(format, model, controller_path)
    45:   model_name = model.class.name.underscore
    46:
    47:   if namespace = controller_path.namespace
    48:     model_name = "#{namespace}/#{model_name}"
    49:   end
 => 50:   binding.pry
    51:
    52:   infer_representer(model_name)
    53: end

[1] pry(#<Roar::Rails::Formats>)> model_name
=> "v1/forms/v1/forms/forms_collection"
[2] pry(#<Roar::Rails::Formats>)> model.class.name.underscore
=> "v1/forms/forms_collection"
[3] pry(#<Roar::Rails::Formats>)> controller_path
=> "v1/forms/forms"
[4] pry(#<Roar::Rails::Formats>)> controller_path.namespace
=> "v1/forms"

I'm not sure I understand the intention behind the namespace prefixing, but you can see here that instead of "v1/forms/forms_collection" for the model_name it chose "v1/forms/v1/forms/forms_collection"

My controller and my model both live in the ::V1::Forms namespace

@apotonick
Copy link
Member

Is that from master? We are working on a new way to do that and I absolutely need your input: trailblazer/roar-rails#73 (comment)

Please, take 5 mins and specify how you would like/expect the namespace computation to work.

Closing this as this is roar-rails.

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

No branches or pull requests

2 participants