我有 3 个模型 Persona、Assertion 和类 P2c 是从类 Assertion 继承的
class Persona < ActiveRecord::Base
# create_table "personas", :force => true do |t|
# t.text "name", :null => false
# t.text "description"
# t.datetime "last_change", :null => false
# end
has_many :p2cs
end
class Assertion < ActiveRecord::Base
# create table "assertions", :primary_key => "id", :force => true do |t|
# t.text "rationale",
# end
end
class P2c < Assertion
#create_table "p2cs", :primary_key => "assertion_ptr_id", :force => true do |t|
# t.integer "persona_id", :null => false
# end
belongs_to :persona, :class_name => "Persona", :foreign_key => "persona_id"
end
我需要帮助来使用 gem active_model_serializers 编写序列化类