Ruby on rails 通过rails将一个json对象从postgres加载到ember数据中?

Ruby on rails 通过rails将一个json对象从postgres加载到ember数据中?,ruby-on-rails,json,postgresql,ember.js,ember-data,Ruby On Rails,Json,Postgresql,Ember.js,Ember Data,我正在尝试创建一个Ember.js应用程序,在模型中,我加载一个JSON作为对象。(只是暂时展示一下。) 以下是我的rails模式: create_table "recipes", force: true do |t| t.integer "recipe_id" t.integer "version" t.string "author" t.json "recipe" t.json "steps" t.integer "paren

我正在尝试创建一个Ember.js应用程序,在模型中,我加载一个JSON作为对象。(只是暂时展示一下。)

以下是我的rails模式:

  create_table "recipes", force: true do |t|
    t.integer "recipe_id"
    t.integer "version"
    t.string  "author"
    t.json    "recipe"
    t.json    "steps"
    t.integer "parent_id"
 end
以及ember中的序列化程序:

class ProtocolSerializer < ActiveModel::Lead
    attributes :recipe_id, :version, :author, :recipe, :steps, :parent_id
end
非常感谢

编辑:我想我已经弄明白了——将json作为字符串导入效果很好,只是它从最后一个网页中删除了“{}”。我应该用“number”而不是“int”

App.Protocol = DS.Model.extend
  recipe_id: DS.attr('int')
  version: DS.attr('int')
  author: DS.attr('string')
  recipe: DS.attr('string')
  steps: DS.attr('string')
  parent_id: DS.attr('int')