Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9022827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:36:50+00:00 2026-06-16T05:36:50+00:00

I have a ember route that uses a date parameter to retrieve a collection

  • 0

I have a ember route that uses a date parameter to retrieve a collection of events. I am using the deserialize function to fetch the collection. After the collection is fetched the url changes from “/day/2012-10-08” to “/day/undefined”.

The events include a range of dates so I can’t use the data to serialize the date parameter. Instead I should be able to return the params on the url. My example below sets an attribute on the router “current_params” on deserialize and returns it on serialize. I am wondering if there is access to the params in the serialize method.

      day: Ember.Route.extend
        route: "/day/:date"

        deserialize: (router, params) ->
          router.set('current_params', params)
          router.get('store').findQuery( App.Event, { date: params.date } )


        serialize: (router, context) ->
          router.get('current_params')

        connectOutlets: (router, context) ->
          router.get('applicationController').connectOutlet( 'timecard', context )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:36:51+00:00Added an answer on June 16, 2026 at 5:36 am

    I’ve seen the named routes get changed to undefined when the serialize method was failing, and though there isn’t enough information here to be sure, I would strongly suspect that to be the case.

    I think it is a mistake to depend on the router to keep a piece of information like that for you. It is not designed to be a repository for arbitrary info, just to keep your application state.

    My suggestion would be to move that date range information into a controller. So if the controller is TimecardController then

    TimecardController = Ember.ObjectController.extend
        #other controller stuff
        #more controller stuff
    
        event_date: new Date
    

    Then in your router

    deserialize: (router, param) ->
        @get('timecardController').set 'event_date', params.date
        @get('store').findQuery App.Event, {date: params.date}
    serialize: (router, context) ->
        date = @get('timecardController.event_date')
        #or on older ember builds @getPath('timecardController.event_date')
        '' + date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Ember.js app that has a Checklist model, where each Checklist has
I try to have some inheritance with attributeBindings between two View. (function(exports) { Ember.MobileBaseView
I have a simple template that loops over a ember-data model. Inside the loop
I have a route that looks like the following: map.newsletter '/newsletter', :controller => newsletter
I am have difficulty setting a belongsTo relationship using ember data. I have a
I have an Ember.js model that's basically just an ID, a title, a body,
I have this Ember router: App.Router = Em.Router.extend({ enableLogging: true, location: 'hash', root: Em.Route.extend({
I have a nested route structure that allows for pagination / sorting / searching
I have a controller that is created by the Ember.Router, and this populates a
I have a Ember.View.ParentView that has two childViews. One of which is a ContainerView.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.