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

camelCased URL being requested from REST API instead of hyphenated URL #2906

Closed
cowboy opened this issue Jan 6, 2015 · 11 comments
Closed

camelCased URL being requested from REST API instead of hyphenated URL #2906

cowboy opened this issue Jan 6, 2015 · 11 comments

Comments

@cowboy
Copy link

cowboy commented Jan 6, 2015

I'm using v0.1.5 of ember-cli with a pod structured app.

  • app/pods/applicant/model.js contains a relationship where DS.belongsTo('applicant-state', {async: true}).
  • app/pods/applicant-state/model.js is uninteresting in every conceivable way.

When I try to display an applicant, I see a console error like GET http://api.loc/applicantStates/8 404 (Not Found).

Is the camelCasing normal?

My API URLs are all hyphenated, like http://api.loc/applicant-states/8

@stefanpenner
Copy link
Contributor

can you should how the link is being generated?

@stefanpenner
Copy link
Contributor

Is the camelCasing normal?

no

@cowboy
Copy link
Author

cowboy commented Jan 6, 2015

I'm trying to render an applicant by going to the route for an applicant. I'm not doing anything else.

@stefanpenner
Copy link
Contributor

I'm trying to render an applicant by going to the route for an applicant. I'm not doing anything else.

is "going" via direct URL manipulation in the address bar, or via link-to, or via transitionTo or..

@cowboy
Copy link
Author

cowboy commented Jan 6, 2015

Direct URL in the address bar.

@stefanpenner
Copy link
Contributor

ah, this is the API request that is incorrect. For some reason I though this was the page you navigated to.

@cowboy
Copy link
Author

cowboy commented Jan 6, 2015

Apologies if I was unclear.

FWIW, I've worked around the issue with this code (via @bmac):

export default DS.RESTAdapter.extend({
  pathForType: function(type) {
    var dasherized = Ember.String.dasherize(type);
    return Ember.String.pluralize(dasherized);
  }
});

@stefanpenner
Copy link
Contributor

@cowboy nah i was multi-tasking and didn't notice the details.

@bmac thanks!

we can keep this issue open here, but it seems like ember-data is normalizing incorrectly so I suspect it is something we need to fix in ember-data.

@stefanpenner
Copy link
Contributor

@stefanpenner
Copy link
Contributor

emberjs/data#2318 would fix this

@stefanpenner
Copy link
Contributor

ember-data bug

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