Ruby on Rails 3 (3.1) ActiveModel Associations (tableless nested models)

前端 未结 3 1537
不知归路
不知归路 2021-01-12 07:01

How to impliment ActiveModel associations (tableless nested models)?

For example:

book has many chapters

With ActiveRecord I would

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-12 08:02

    With rails versions >= 2.3.x you can use the activerecord-tableless gem. With that gem you can have associations and validations without a database.

    Update

    I have been added as author to the gem and I have updated the gem to support newer Rails versions. So now we can have tableless models with associations in Rails versions >= 2.3

提交回复
热议问题