This repository has been archived by the owner. It is now read-only.

Name in Ember.Resource clashes with properties: ['name'] #1

Closed
rmossuk opened this Issue Feb 1, 2012 · 6 comments

Comments

Projects
None yet
2 participants
@rmossuk

rmossuk commented Feb 1, 2012

When i have a name property like this :

App.Contact  = Ember.Resource.extend({
  url:        '/contacts',
  name:       'contact',
  properties: ['name'],
 ....

The name property is being used in the json as :

{"value of property name"=>{"name"=>"value of property name"} 

when i post a form using the edit template

{{#with contact}} 
{{view Ember.TextField valueBinding="name" placeholder="name"}} 
{{#if id}} 
{{submitButton "Update"}} 
{{else}} {{submitButton "Create"}} 
{{/if}}
{{/with}}

thanks a lot for all the help 

@dgeb dgeb closed this in c9e6568 Feb 1, 2012

@dgeb

This comment has been minimized.

Show comment Hide comment
@dgeb

dgeb Feb 1, 2012

Member

@rmossuk - Thanks for reporting this. I believe I've fixed these naming collisions, but please reopen this if the problem continues.

FYI: I'll add some proper tests to this lib now that it's seeing a fair bit of use.

Member

dgeb commented Feb 1, 2012

@rmossuk - Thanks for reporting this. I believe I've fixed these naming collisions, but please reopen this if the problem continues.

FYI: I'll add some proper tests to this lib now that it's seeing a fair bit of use.

@rmossuk

This comment has been minimized.

Show comment Hide comment
@rmossuk

rmossuk Feb 1, 2012

@dgeb thanks for fixing this so quickly.

There is still one problem with this bug though.

When i click to show the new text field like this

{{#with company}}
  {{view Ember.TextField valueBinding="name" placeholder="Name"}}
  {{view Ember.TextField valueBinding="description" placeholder="Description"}}
  {{#if id}}
    {{submitButton "Update"}}
  {{else}}
    {{submitButton "Create"}}
  {{/if}}
  <a href="#" {{action "cancelForm"}}>Cancel</a>
{{/with}}

It display the company in the value attribute like this :

<input id="ember793" class="ember-view ember-text-field" type="text" value="company" placeholder="Name">

rmossuk commented Feb 1, 2012

@dgeb thanks for fixing this so quickly.

There is still one problem with this bug though.

When i click to show the new text field like this

{{#with company}}
  {{view Ember.TextField valueBinding="name" placeholder="Name"}}
  {{view Ember.TextField valueBinding="description" placeholder="Description"}}
  {{#if id}}
    {{submitButton "Update"}}
  {{else}}
    {{submitButton "Create"}}
  {{/if}}
  <a href="#" {{action "cancelForm"}}>Cancel</a>
{{/with}}

It display the company in the value attribute like this :

<input id="ember793" class="ember-view ember-text-field" type="text" value="company" placeholder="Name">
@dgeb

This comment has been minimized.

Show comment Hide comment
@dgeb

dgeb Feb 2, 2012

Member

Makes sense. I'll have to handle initialization of these props too. For now, when you create a new object, initialize its properties like this:

App.Contact.create({name: ''})

I'll follow up when I get a better fix in place.

Member

dgeb commented Feb 2, 2012

Makes sense. I'll have to handle initialization of these props too. For now, when you create a new object, initialize its properties like this:

App.Contact.create({name: ''})

I'll follow up when I get a better fix in place.

@rmossuk

This comment has been minimized.

Show comment Hide comment
@rmossuk

rmossuk Feb 2, 2012

thanks again that fixed it!

rmossuk commented Feb 2, 2012

thanks again that fixed it!

@dgeb

This comment has been minimized.

Show comment Hide comment
@dgeb

dgeb Feb 2, 2012

Member

I've made some changes to prevent these and other namespace collisions. Please see the CHANGELOG for details:

https://github.com/cerebris/ember-rest/blob/master/CHANGELOG

I've also updated the example app and blog posts to reflect these changes.

Member

dgeb commented Feb 2, 2012

I've made some changes to prevent these and other namespace collisions. Please see the CHANGELOG for details:

https://github.com/cerebris/ember-rest/blob/master/CHANGELOG

I've also updated the example app and blog posts to reflect these changes.

@rmossuk

This comment has been minimized.

Show comment Hide comment
@rmossuk

rmossuk Feb 2, 2012

thanks again!

rmossuk commented Feb 2, 2012

thanks again!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.