App.get('router').send causing this error Uncaught TypeError: Cannot redefine property: __ember1346884664897 - ember.js

Anyone have any ideas why I'm getting this error:
Uncaught TypeError: Cannot redefine property: __ember1346884664897
when calling:
App.get('router').send('tags')
I'm making the call from one of my views, the router is in the correct state, and as far as I can tell I'm doing everything by the book.
Would really appreciate any ideas...
Created a gist that might help explain things a little better. https://gist.github.com/3647288

App.router.send('something') will look for a function named something in your current state, but you are trying to use route name there. You should have something like showTags in you router and use App.router.send('showTags').
Head to docs http://docs.emberjs.com/#doc=Ember.Router&src=false and look at the part Transitions Between States

I had this problem when I named an action and a state the same way. Perhaps you have the same thing now.

Related

Irrelevant syntax issue in apiblueprint

So I've been designing this REST API using apiary.io and I'm almost done.
There is this syntax issue that I get which doesn't make sense at all.
I have a [GET] action for a specific resource But It seems like apiary confuses it with a [GET] action for another resource and says
Action with method 'GET' already defined for resource '/api/quotes?{sq}&{author_id}&{ratingrange}&{quoteidrange}&{authorratingrange}&{authoridrange}'
Here is the API link :
https://app.apiary.io/kalematie/editor
the syntax issue is in line 987
I would like to know whether I'm doing something wrong or there's a bug in the tool.
Thanks in advance.

What is the proper way to append view/component to existing view

I have been trying to add a component within a view, I could do it but I am getting some warning message as well like "DEPRECATION: Using the defaultContainer is no longer supported". There is a related post here : emberjs append works but raises Assertion Failed error but not sure what I am doing wrong. Here is my jsbin link : http://jsbin.com/tuwanava/1/
Your help will be very much appreciated. Thanks.
Use
sticky.pushObject(App.ConfirmDeleteComponent.create());

Regex in RedirectRoute not working correctly

I have looked into how to use a regex within a RedirectRoute using webapp2. I have tried formatting it the way it says to do so here: http://webapp-improved.appspot.com/guide/routing.html#the-url-template and I still cannot get my regex to work. Here is what I have:
RedirectRoute('/book/<bookId:([0-9]+)><title:(.*)>',handlers.book,name='book')
the call for this is:
self.redirect_to('book/%s_%s' %(bookId,title))
and an example of the url I am expecting is:
book/5907332378656768_The-Wizzard-of-Oz
When I run my app I get the following error:
Error: "Route named u'book/5907332378656768_The-Wizzard-of-Oz' is not defined.
Any help would be greatly appreciated.
EDIT:
Hey everyone! Thanks to Brent's response I was able to fix the problem.
I had to change self.redirect_to('book/%s_%s' %(bookId,title))
to the following: self.redirect('book/%s_%s' %(bookId,title))
Thank you everyone for your help!
A Google search for webapp2 error route "is not defined" finds the Webapp2 source code. That error message is in the method default_builder() which is called from redirect_to(). That method looks for the name field ('book' in this case). Maybe you meant to call redirect() instead?
I think you can leave the parentheses off the patterns:
RedirectRoute('/book/<bookId:[0-9]+><title:.*>',handlers.book,name='book')

Why is my Ember.Router giving this TypeError?

I'm using Ember built from git master. My RouteManager is not complex, but when I try to start my app, I get this error:
Uncaught TypeError: Property '1' of object , is not a function
Following the trace indicates that this is happening on the app's initialization.
This jsfiddle shows the problem, although you'll have to look in the javascript console to see the error message. My actual router will be more complex than this, but I've pared it down to the bones to try to eliminate potential error sources.
You need to update your version of Ember Data to the latest version from master, as the injection API changed.
Here is a fiddle which "works".
http://fiddle.jshell.net/Sly7/ZySzK/
I pick up an ember-data resource from another fiddle I found on stackoverflow.
The way of populating the arraycontroller is weird. Usually you pass the context in the connectOutlet method of the controller, by specifying a context (in your case, it should be Sylvius.Section.find() )
I don't know why, but doing this, I have the error 'Sylvius.Section has no method find'... perhaps an other mess due to ember-data/emberjs bad version.

Ember data - How to update record

I did implement some code with ember-data talking to a sinatra json-app. Method findAll works as expected and load of records.
Also I did implement the updateRecord-method in the DS.Store.create, but don't really know how to update and commit. Please, see the code here (for sake of brevity, I didn't include the jquery functions): http://pastie.org/3197008
I tried the following:
a = Todos.records.objectAt(0).set("text", "should be so")
a.store.commit()
But I get the following error: TypeError: Object (subclass of DS.State) has no method 'enter'
How should I update records? Or did I forget to implement something for the update?
Thanks in advance!
I had the same problem. I think this is a bug in ember-data. The problem is that the code was not properly initializing certain substates, and those substates were not state instances but rather state classes.
I fixed the problem by defining a function that generates a new state instance (with properly created substates) each time it is called. You can find my changes here.
I also requested that the ember-data folks pull my fix, so hopefully this issue will disappear soon. You can view the pull request for discussion.
i had the same problem this morning. Use the emberjs git version