あきくもちゃのブック
mindia › あきくもちゃのブック › 単語

rails-polymorphic

秋雲茶 · 2012-04-27 更新 · 履歴(1)

>|ruby|
class Blog < ActiveRecord::Base
has_many: :attached, as:attachable
end

class Entry < ActirveRecord::Base
has_many: :attached, as:attachable
end

class Attached < ActiveRecord::Base
blongs_to: :attachable, polymorphic: true
end
||<

タグ