Last active
August 29, 2015 14:02
-
-
Save mattboldt/8d7cad9e0c6ccc48cee4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Getting the following error #### | |
# Error while loading route: undefined | |
# Store | |
# Override the default adapter with the `DS.ActiveModelAdapter` which | |
# is built to work nicely with the ActiveModel::Serializers gem. | |
App.ApplicationAdapter = DS.ActiveModelAdapter.extend() | |
# Router | |
App.Router.map -> | |
@resource('documents', { path: '/' }, -> | |
@route('new') | |
@resource('document', { path: ':document_id' }) | |
) | |
App.DocumentsRoute = Ember.Route.extend | |
model: -> @store.find('document') | |
# Document model | |
App.Document = DS.Model.extend | |
title: DS.attr('string') | |
# App controller | |
App.ApplicationController = Ember.Controller.extend() | |
# Documents controller | |
App.DocumentsController = Ember.ArrayController.extend | |
actions: | |
addEntry: -> | |
@store.createRecord('document', { title: @get('newDocumentName') }) | |
@set('newDocumentName', "") | |
# Documents view | |
App.DocumentsView = Ember.View.extend | |
templateName: 'documents/index' | |
App.DocumentView = Ember.View.extend | |
templateName: 'documents/show' | |
#### Rails #### | |
# document_serializer.rb | |
class DocumentSerializer < ActiveModel::Serializer | |
attributes :id, :title | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment