Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
create_table "posts", :force => true do |t|
t.string "title"
t.boolean "published"
t.integer "content_id"
t.string "content_type"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "topics", :force => true do |t|
t.text "body"
end
create_table "links", :force => true do |t|
t.string "link"
t.text "description"
end
create_table "podcasts", :force => true do |t|
t.string "link"
t.text "description"
end
Собственно, в бд структура такая же.
def edit_posts_content_path(content)
eval("edit_posts_#{content.class.to_s.downcase}_path(content)")
end
Полиморфные связи