How can we use store in Ember 2.x - ember.js

I am upgrading my app from Ember 1.10 to 2.2. I have used store in 1.10 and is working fine there, but when I try to copy that in 2.2, it gives me error because of store. Is there a specific way to initialize the store as I am not able to get the store all the time. In some controllers, not all the data of the store is available. Please help

Related

Basic Ember app not working with default adapter

Here is the source code.
I'm running Ember-CLI from the master branch of the git repo (currently version 2.2.0-beta.1-master-e803ac7fa6) and linking via npm. This should be using versions 2.2.0 of Ember and Ember Data. In the middle of the basic tutorial, I hit an issue with Mirage and Ember Data. Without explicitly creating an application adapter, the app fails. There is a 404 error being thrown on the route that should be handled by Mirage, as well as numerous Adapter errors. No errors are shown during ember serve.
In trying to fix this, I ran into another issue. After running ember g adapter application, the app loaded in the browser but there was still an error because this generated a RESTAdapter instead of the preferred JSONAPIAdapter. After manually switching to the JSONAPIAdapter, everything is fine.
Is this an issue with Ember-CLI still using an old version of Ember Data somehow? Update: #Michael and #Gaurav found the issue with Ember-CLI. See his answer for the Github issue link.
The original question still stands, though. Should Ember be able to function without explicitly creating an adapter?
This is a bug with Ember CLI 2.2.0-beta.1 - it's using the wrong adapter type by default. Can you open an issue on Ember CLI? Thanks!

Ember 2.0 without Ember cli?

Seems nowadays everything including loading modules is generated from embercli.
Is it possible to create a emberjs 2.0 application without the use of ember-cli?
What are some limitations of not using ember-cli?
Yes, it definitely still is. I support 5 ember applications at my work. 2 of which live on the ASP.Net stack, 3 are on a Java stack. The 2 on the ASP.Net stack aren't using ember-cli and work perfectly fine as a global application.
Here, I've created an ember app without ember-cli: http://emberjs.jsbin.com/xeqevogado/edit?html,js,output

How can I update ember-i18n component to work in ember 1.10 with HTMLbars?

My ember 1.8 app is built with grunt CLI and migrating to ember CLI isn't working out, but I'm upgrading to ember 1.10 so can use HTMLbars. The app uses ember-i18n so after loading and resolving models as it transitions to the first View, I get the error 'helper named 't' could not be found'. In 'vendor\ember-i18n\lib\i18n.js' I tried changing 'Handlebars.registerHelper' to 'Ember.HTMLBars._registerHelper', but then I get various 'is undefined' errors out of the i18n component. I read that i18n isn't supported in ember 1.9+ but I need it to work. How can I update it to work in 1.10?
I hadn't realized that my i18n package, which hadn't been updated in a year, and doesn't support the latest Ember compiler, was a forked version (lawitschka). When I switched to the original project, which is up-to-date (jamesarosen), I was able to get my Locale 'label' setup working by changing 'Ember.I18n.set('translations', data)' to 'Ember.I18n.translations = data'.

Is Emberjs (with Ember Data) and Django (with rest framework) ready for prime time?

I have been studying emberjs and tried to get it to work with the django rest framework, without much luck.
Here is what I have found:
django rest framework does not natively spit the json format that Ember expects
ember django rest framework adapter is based on ember-data, which leads to next point
ember-data is not production ready, and the rest framework adapter does not work on the latest ember-data
someone mentioned to roll your own without using ember data in this link http://discuss.emberjs.com/t/ember-data-endless-frustration/893/2 but it makes me feel like doing things twice since I already defined my models in django.
My question is, is this combination ready for prime time and has anyone used this combination for any production sites?
Author of ember-django-adapter here. We just released version 1.0.0 compatible with Ember Data 1.13.7 and higher and Django REST Framework 3.0.0 and higher. It has grown with Ember for the past year and a half, and is ready for prime time.
I'm using ember-data-django-rest-adapter and it's working fine with latest stable ember and canary ember-data. There's an experimental ember1.0 compatible branch. Luckily the code for django's adapter as of this moment is only 300 lines and easily understandable.
To answer your question: I think it's ready for startups to use in production in a few months (we're going live in January 2014).
As of April 2015, the package that #ObviousCat mentioned is deprecated in favor of the django rest framework ember package. We're using it in our Ember/Django project and it does wonders for "enhancing" DRF to play with Ember.
If you want to create the adapter on the client side, there is also an option for that with the ember django adapter, although we decided to make changes to the server side instead of the client side, so we aren't using that.

Django + Google App Engine: app engine helper for django or use_library?

There seem to be 2 ways to use django 1.1 with GAE
Google App Engine helper for django
The new use_library() function
We currently use the first. Should we switch? And what's the difference between the two?
use_library loads an unpatched version of django in the production environment, so many things will not work out of the box on app-engine.
The helper applies a series of patches to the django libraries to enable things like Sessions, test, cache framework, etc. If you do not add your own copy of django into your helper application and you are using the latest release (r100 or higher), the helper first tries to load django 1.1 and if it does not succeed then loads 1.0. You can see this in appengine_django/__init__.py::LoadDjango.
On production GAE, django 1.1 always exists, so it is loaded first.
However, on your development environment the dev server SDK does not distribute Django. Therefore, it uses whatever version of Django it can find, first trying 1.1 and then 1.0 and if it cannot find one then throws UnacceptableVersionError.
You probably want to use the helper and not use_library because then you will need to patch the raw django libraries yourself, thus duplicating the work in the helper. Whether you distribute your own version of django, either as a folder or zip file is up to you. One of the advantages of not distributing your own copy of django is that as google applies security patches you automatically get them without having to redeploy your application.
the replacement is called django-nonrel (and djangoappengine)... you can find it at
http://www.allbuttonspressed.com ... with django-nonrel, you should be able to run pure Django apps on top of App Engine without tweaking your models!
FYI, there is at least one more way to get Django 1.1 in GAE.
Take a look at http://code.google.com/p/app-engine-patch/
It allows use to use most of Django features including Admin.
app-engine-patch seems to have died:
http://code.google.com/p/app-engine-patch/issues/detail?id=253
As of GAE 1.5.0, there's a much simpler way of specifying a Django version.
In appengine_congif.py, include the line
webapp_django_version = '1.2'
This will cause the use_libary() to happen under the covers.