ember.js,ember-data,active-model-serializersRelated issues-Collection of common programming errors


  • Ashley Coolman
    javascript ember.js
    ContainerView.pushObject() does not automatically wire-up dynamically added views with a Container object. The lack of an auto-wired container causes a render failure when a view renders a template that contains a handlebars render helper.SIMPLE CASE THAT WORKS (KIND OF)View:App.DynamicView = Em.View.extend({templateName: ‘dynamic’,didInsertElement: function() {var control = this.get(‘controller’);control.send( ‘view_inserted’, this.templateName, control._debugContainerKey);control.send(‘callDy

  • kingpin2k
    javascript ember.js
    I’m currently upgrading out Ember application to Ember 1.3.0 stable. I’m encountering the following issue in our Jasmine tests:Error: Assertion Failed: You must use Ember.set() to access this property (of [object Object])at new Error (native)at Error.Ember.Error (http://localhost:8888/assets/rake-ember.js?body=true:837:23)at Object.Ember.assert (http://localhost:8888/assets/rake-ember.js?body=true:79:13)at Object.Ember.MANDATORY_SETTER_FUNCTION [as keywords] (http://localhost:8888/assets/rake-em

  • commadelimited
    ember.js ember-data
    I’m working on building up unit tests for our Ember applications. The current set of tests I’m targeting are our Models. I’ve got a set of tests that work really well for Models based on Ember Data, but seem to fail when based on Ember.Object. Here are two examples:App.Person = DS.Model.extend({First: DS.attr(“string”),Last: DS.attr(“string”) });App.Person2 = Ember.Object.extend({First: null,Last: null });And the test which passes for DS.Model:it(‘has a valid attribute: First’, function() {var

  • ianstarz
    ember.js uikeyboard collectionview
    EDIT: SOLVED, was accidentally creating instead of extending the ember view. See answer below.I am creating a keyboard for a touchscreen device that does not have a native touchscreen keyboard in the browser (Google Chrome on an HP touchscreen, though correct me if I’m wrong. I’m open to an easier solution.)I’d like to split out the keyboard into separate rows to make the styling easier.keyboardView: Ember.CollectionView.create({elementId: ‘search-keyboard’,content: [[ ‘q’,’w’,’e’,’r’,’t’,’y’,’u

  • Martin
    ember.js ember-data
    I’m trying to set a default value of a property, depending on another property of the model being loaded.How do I trigger the setOthers method, after the model has loaded? The totalPoints property can change afterwards, and the user should also be able to change the others value, from the initial value set in the setOthers method.I have this User model:App.User = DS.Model.extend(# [ … ]competenceRatings: DS.attr(‘competenceRatings’) )Here’s the controller:App.UsersEditController = Ember.Object

  • suri
    ember.js
    I came across following issue while building ember from source, how can i fix this.$ bundle installFetching gem metadata from https://rubygems.org/…….Fetching gem metadata from https://rubygems.org/..Resolving dependencies…Using rake (10.1.0) Installing json (1.8.1)Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension./usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require’: cannot load such file — mkmf (LoadError)from /usr/lib

  • user1189762
    ruby-on-rails rest backbone.js ember.js frontend
    I already know that ember.js is a more heavy weight approach in contrast to backbone.js. I read a lot of articles about both.I am asking myself, which framework works easier as frontend for a rails rest backend. For backbone.js I saw different approaches to call a rest backend. For ember it seems that I have to include some more libraries like ‘data’ or ‘resources’. Why are there two libraries for this? So whats the better choice? There arent a lot of examples to connect the frontend with the ba

  • user510159
    ember.js playframework-2.0 handlebars.js rhino precompile
    I’m trying to write an SBT plugin for PlayFramework 2.1 which would precompile handlebars templates located in app/assets/templates. I will of course share this plugin when it is complete. I found this howto http://eng.netwallet.com/2012/04/25/emberhandlebars-template-precompilation-with-play/ which was a little outdated, but it was no problem adapting it for Play! 2.1.Then I tried to compile a simple template file, but SBT failed with the following:ember: processing template test[error] /…/te

  • jayturley
    javascript ember.js ember-data
    I’m using Ember v1.4.0 and Ember Data v1.0.0 beta 5. I am having trouble getting the DS.Store.filter() function to work. When I go to the #/orders route, I see my list of orders. But when I go to the route #/orders/created, the full list of orders is shown, no matter how I implement the filter function. In addition, when I edit the #/orders route and put a filter on it, it works on that route and on the #/orders/created route. Its like the model never gets changed in the child route. Any help wo

  • Helge Talvik Söderström
    ember.js
    Working hard on my Ember app here, and it’s going along fine. However, I’ve run into an issue of unexpected behaviour and I’m not sure regarding the best approach to this problem.The problem is that in a specific route, I want to render another route into another outlet. However, the other route that I render into the other outlet doesn’t retain it’s own model.If I do this:App.TestRoute = Ember.Route.extend({model: function() {return {heading: “Test”,testContent: “This is test.”}} });App.IndexRo

  • commadelimited
    ember.js ember-data
    I’m working on building up unit tests for our Ember applications. The current set of tests I’m targeting are our Models. I’ve got a set of tests that work really well for Models based on Ember Data, but seem to fail when based on Ember.Object. Here are two examples:App.Person = DS.Model.extend({First: DS.attr(“string”),Last: DS.attr(“string”) });App.Person2 = Ember.Object.extend({First: null,Last: null });And the test which passes for DS.Model:it(‘has a valid attribute: First’, function() {var

  • Martin
    ember.js ember-data
    I’m trying to set a default value of a property, depending on another property of the model being loaded.How do I trigger the setOthers method, after the model has loaded? The totalPoints property can change afterwards, and the user should also be able to change the others value, from the initial value set in the setOthers method.I have this User model:App.User = DS.Model.extend(# [ … ]competenceRatings: DS.attr(‘competenceRatings’) )Here’s the controller:App.UsersEditController = Ember.Object

  • jayturley
    javascript ember.js ember-data
    I’m using Ember v1.4.0 and Ember Data v1.0.0 beta 5. I am having trouble getting the DS.Store.filter() function to work. When I go to the #/orders route, I see my list of orders. But when I go to the route #/orders/created, the full list of orders is shown, no matter how I implement the filter function. In addition, when I edit the #/orders route and put a filter on it, it works on that route and on the #/orders/created route. Its like the model never gets changed in the child route. Any help wo

  • ptmoy2
    ember.js ember-data ember-model
    In my application, I have the common parent/child relationship in my route map.App.Router.map(function () {this.resource(‘strats’, {path: “/”}, function() {this.route(‘strat’, {path: “/strat/:strat_id”});}); });My understanding is that when Ember first enters the parent route, it calls find() to get all models, which generally triggers an Ajax call to the server. Then when Ember subsequently transitions to a child route, it first calls find(), followed by find(id). If I’m using a data layer wi

  • jeckyll2hide
    ember.js ember-data
    I have the following model:App.Service = DS.Model.extend(App.NodeMixin, {properties : DS.belongsTo(‘App.ServiceProperties’),…. });properties is an embedded property:App.Adapter.map(‘App.Service’, {…properties: {embedded: ‘always’} });Whenever I want to create a new service, I create also the properties:this.transaction = this.get(‘store’).transaction(); var entry = this.transaction.createRecord(App.Service, {}); var properties = App.ServiceProperties.createRecord(); entry.set(‘properties’, p

  • alalani
    ruby-on-rails ember.js mongoid ember-data
    I have two models in Mongoid: Teams and Players where Players is embedded_in Teams. On the front end we use Ember.js and every time I add a new Player to a team I save the parent record (ie. the Team). Every time I update the parent record on the backend in rails I call Team.find(params[:id]).update_attributes(params[:team])Now the problem is each time I call update_attributes all the embedded objects (ie the players) get recreated with new ids and saved in the team. This is unexpected since I w

  • Abdull
    ember.js ember-data
    Ember Data’s documentation discusses different events in a model instance’s lifecycle. I would expect that the didUpdate event is triggered whenever any of a model instance’s properties change. But my experiments don’t show this behavior. Here is a JS Bin example: http://jsbin.com/uziwam/9/edit In that example, you can see that I register handlers on the “ren” model instance: I register handlers (console.log(..) messages) for the didLoad and didUpdate events.When starting the code, “ren’s” didL

  • HaoQi Li
    ember.js ember-data
    General question: I would like to get an overview of current transaction (currentTransaction) and default transaction (defaultTransaction).Specific question: I’ve been comparing in the Ember controller this.get(‘model’).save() and this.get(‘store’).commit().this.get(‘model’).save() will eventually call Ember-data Store’s get(this, ‘currentTransaction’).commit()., see github.this.get(‘store’).commit() will eventually call Ember-data Store’s get(this, ‘defaultTransaction’).commit(), see github.In

  • stephanos
    ember-data
    I need Ember Data to update one of my models in bulk. So I set bulkCommit: truein the DS.RESTAdapter. But now it even uses bulk commits for updates to a single record! This is very unexpected behaviour.So how do I modify Ember Data to only use bulk commits when more than 1 item is committed?

  • Deepak
    ember.js ember-data
    I am trying to learn ember.js using the online tutorials http://emberjs.com/guides/getting-started/I reached this step http://emberjs.com/guides/getting-started/creating-a-new-model/ and here is the application.https://github.com/42races/ember-apps/tree/master/todomvcAt this point I am not able to proceed, am getting an error and not able to proceed, here is a screenshot of the error I am getting.How do I proceed? Please someone help me.

  • timpone
    ruby-on-rails ruby-on-rails-3.2 paperclip active-model-serializers
    I have an asset model class and it has different sizes using paperclip 3.5.2:class AssetSerializer < ActiveModel::Serializerattributes :id, :asset # works fine# would like to output small but don’t seem to be able to#attributes :id, :asset, :asset(:small) endIt’s a bit confusing because Paperclip uses the name class and the model is called class (ok really confusing). I get the following error:/Users/jt/repos/rails/app/serializers/asset_serializer.rb:2: syntax error, unexpected ‘(‘, expectin

  • shicholas
    ruby-on-rails-4 active-model-serializers
    I have a serializerclass FundingSerializer < ActiveModel::Serializerattributes :id, has_one :userhas_one :tournamentembed :ids, include: true endThat initializes with the proper associationsFundingSerializer.new(Funding.first).to_jsonyields”{\”users\”:[{\”id\”:2,\”first_name\”:\”Nick\”}],\”tournaments\”:[{\”id\”:1,\”end_date\”:\”2013-07-21T23:18:54.981Z\”,\”start_date\”:\”2013-07-14T23:18:54.980Z\”}],\”funding\”:{\”id\”:1}}”but, FundingSerializer.new(Funding.all).to_jsongets this error.undefi

  • Jesper
    ruby-on-rails active-model-serializers
    I’ve got two models:class Subject < ActiveRecord::Basehas_many :user_combinationshas_ancestry endclass UserCombination < ActiveRecord::Basebelongs_to :stagebelongs_to :subjectbelongs_to :user endAnd two serializers:class UserCombinationSerializer < ActiveModel::Serializerattributes :idbelongs_to :stagebelongs_to :subject endclass SubjectSerializer < ActiveModel::Serializerattributes :id, :name, :description, :subjectsdef include_subjects?object.is_root?enddef subjectsobject.subtreeen

  • Gawyn
    active-model-serializers
    When rendering the json of a model with nested associations I get the following error:undefined method `serializable_hash’ for #<ActiveModel::ArraySerializer:0x007fe761592d88>This is my code:class EventSerializer < ActiveModel::Serializerattributes :id, :name, :datehas_many :markets endclass MarketSerializer < ActiveModel::Serializerattributes :id, :bet_limit_timehas_many :options endclass OptionSerializer < ActiveModel::Serializerattributes :id, :name, :odds endThe error appears

  • user1938736
    ruby-on-rails ember.js active-model-serializers
    I’m trying to sideload data in active_model_serializer for an Ember application and get a NoMethodError when I attempt to include the objects:undefined method `object’ for #Email:0x00000100d33d20It only happens when :include => true is set, like this:class ContactSerializer < ActiveModel::Serializerembed :ids, :include => trueattributes :first_name, :last_namehas_many :emails endMy models look like this:class Contact < ActiveRecord::Baseattr_accessible :first_name, :last_name, :company,

  • benburton
    ember.js ember-data active-model-serializers
    I have a few models in Rails that look something like this:class Issue < ActiveRecord::Basebelongs_to :reporter, class_name: ‘User’belongs_to :assignee, class_name: ‘User’has_many :comments endclass User < ActiveRecord::Base endclass Comment < ActiveRecord::Base endwith serializers like so:class IssueSerializer < ActiveModel::Serializerattributes :idembed :ids, include: truehas_one :reporter, :embed => :idshas_one :assignee, :embed => :ids endclass UserSerializer < ActiveMod

Web site is in building