Couple questions, dates and controller Actions

Hi People,

I have a couple issues with ember, which I’m loving so far.

version details:

 DEBUG: -------------------------------
 DEBUG: Ember      : 1.6.0-beta.3+pre.2e4d67f6
 DEBUG: Ember Data : 1.0.0-beta.7.f87cba88
 DEBUG: Handlebars : 1.3.0
 DEBUG: jQuery     : 1.11.0
 DEBUG: ------------------------------- 
  1. Serialise of date time does not appear to be working i have some JSON like this:

    {“statuses”:[{“id”:“402502d6-071d-469a-8aab- b468bf64fe39”,“body”:“FFFFFFFFFFF”,“emotion_ids”:,“created_at”:“Mon, 21 Apr 2014 01:59:15 +0000”,“updated_at”:“Mon, 21 Apr 2014 01:59:15 +0000”},{“id”:“a6351176-32cd-45e4-9bee-dfc3a9a68739”,“body”:“20.4.2014”,“emotion_ids”:,“created_at”:“Mon, 21 Apr 2014 01:58:35 +0000”,“updated_at”:“Mon, 21 Apr 2014 01:58:35 +0000”}]} But im just getting empty for the date fields.

On all of my statuses entities the created_date and the updated_date are blank.

  1. When I visit this controller action:

    App.StatusesCreateController = Em.ObjectController.extend(Ember.SimpleAuth.LoginControllerMixin, { actions: { create: function() { var controller = this;; this.transitionToRoute(‘statuses.index’) } } });

I notice a new empty record for status appears each time i visit the controller, any ideas why?

Thanks for the help! Maxus

Any chance of us getting a js bin/js fiddle for this? Here is a template. I don’t know if others can spot your problem based on what you posted, but for me I need more info.

for issue 1, this examples shows the date not showing up from the statuses.

Redacted my original response in favor of Ember Data Canary - JSFiddle - Code Playground

Still doesn’t write out a list of created dates? is it doing it for you?

Sorry not sure I understand, the original JSbin shows dates not rendering correctly?

I worked out my second problem in the route im doing this:


This issue is that when you visit the route it creates a new record, even if the controller didn’t save it.

Here is a similar example showing dates with transforms working Ember Data Canary - JSFiddle - Code Playground

Fixture data doesn’t run through the transforms, needed to use a library to simulate an API response. Anyway, this works so hopefully that addresses whatever problem you’re seeing.

this seems to work with my data, so now im baffled.

Thanks for your help, i just figured it out. it was calling item.created_at instead of just created_at. stupid me :frowning: