<分区>
我非常懒惰,不喜欢进行迁移。我想制作无论如何都会使用的模型,并让其他东西为我在 ruby 中计算迁移,因为 .Net 已经宠坏了我。是否有 gem 可以让我从模型中迁移事件记录?由于您从未在 ruby 中显式设置类型,这有可能吗?
<分区>
我非常懒惰,不喜欢进行迁移。我想制作无论如何都会使用的模型,并让其他东西为我在 ruby 中计算迁移,因为 .Net 已经宠坏了我。是否有 gem 可以让我从模型中迁移事件记录?由于您从未在 ruby 中显式设置类型,这有可能吗?
最佳答案
您可以使用 DataMapper而不是 ActiveRecord。
DataMapper 文档中的示例代码:
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'mysql://localhost/test')
class Person
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
end
DataMapper.auto_migrate!
关于.net - Ruby 中的代码优先等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16719981/