Вот моя форма в шаблонеЭмбер рельсы вставка данных с пустыми полями
<form>
{{view Ember.TextArea valueBinding="comments" placeholder="Please type your comment here"}}
<div class="form-footer">
<button type="submit" class="btn pull-right btn-primary" tabindex="100" {{action saveIndianize}}>Save</button>
</div>
</form>
Вот мой JS модель
App.Comment = DS.Model.extend({
post_id: DS.attr('number'),
user_id: DS.attr('number'),
comments: DS.attr('string'),
created_at: DS.attr('date'),
job: DS.belongsTo('App.Post',{embedded:true}),
});
Это мой сериализатору
attributes :id,:post_id,:user_id,:comments,:created_at
Вот мои рельсы контроллер
@comment = Comment.new(user_id: params[:user_id],post_id: params[:post_id],comments: params[:comments])
Когда я представить ошибку формы метания, как
Uncaught Error: assertion failed: Your server returned a hash with the key comments but you have no mapping for it
Он вставляет в базу данных с идентификатором (первичный ключ), created_at и updated_at. Но я не мог видеть user_id, post_id
и comments
.
Как я могу решить проблему.
Какова версия ember.js и Ember-данных? –