You could use migrations. But thats just another way of describing the table.
If you want another approach (defining a model and then letting the abstraction
layer create the required database), you could use datamapper instead[1].
Then, you class will look like this:
1 class Post
2 include DataMapper::Resource
3 property :id, Integer, :serial => true
4 property :title, String
5 property :subtitle, String :lazy => [:show]
6 property :body, Text :lazy => [:show]
7 property :views, Integer, :lazy => [:show]
8 property :summary, Text
9 end
#and
Post.auto_migrate!
will create/migrate your table automatically.
分享到:
相关推荐
Pro ActiveRecord Databases with Ruby and Rails.pdf
要获得 Enum Table 的额外好处,建议您迁移到标准 ActiveRecord 枚举,然后根据需要将代码中的枚举值同步到数据库。 Enum Table 与最高 4.1.x 的 ActiveRecord 版本兼容,但目前没有计划支持 4.2.x。 什么? 当您...
ActiveRecord简单实例_activerecord.zip
gem 'acts_as_commentable' Rails gem 'acts_as_commentable' , '3.0.1' Rails gem 'acts_as_commentable' , git: 'git@github.com:jackdempsey/acts_as_commentable.git' , branch: '2.x' 生成器 Rails 3+ ...
Castle.ActiveRecord官方已经停止更新了,官方最高支持到NHibernate 3.1.0.4000,这个版本还有不少问题(例如:[NH-2213] - CLONE -Wrong parameters order in IQuery with SetParameterList and Filter)。...
Castle.ActiveRecord For .NET FrameWork 2.0 如果你想使用Castle.ActiveRecord,但又不想使用.NET Framework 3.0/3.5/4.0或更高版本,那么这个就是你所需要的,For .NET FrameWork 2.0,我整理了好久,自己从官方...
Apress Pro ActiveRecord Databases with Ruby and Rails.pdf <br>好书一本
将ActiveRecord中的NHibernate升级到3.3.0GA,排除编译的bug问题,保留ActiveRecord的完整功能,【Castle.ActiveRecord 升级NHibernate到3.4.0GA】的功能不完整!
Apress Pro ActiveRecord Databases with Ruby and Rails <br>Active Record has primarily been covered as a subsection, or maybe as a chapter or two, within a larger scoped book generally about the ...
CASTLE ACTIVERECORD学习实践(1):快速入门指南 CASTLE ACTIVERECORD学习实践(2):构建配置信息 CASTLE ACTIVERECORD学习实践(3):映射基础 CASTLE ACTIVERECORD学习实践(4):实现ONE-MANY关系的映射 CASTLE...
MyBatisPlus的ActiveRecord实现CRUD示例代码
userstamp, 这个 Rails 插件扩展ActiveRecord Userstamp插件( v-2.0 )概述Userstamp插件扩展了 ActiveRecord::Base,以添加对'创建者','更新程序'和'deleter'属性的自动更新。 它是基于 ActiveRecord::Timesta
Castle.ActiveRecord 的资料很多,但是WINFORM的没几个,于此我专门写了个例子献给初学Castle.ActiveRecord的童鞋们,希望这篇文档能够帮到你们。这个例子使用的是ACCESS数据库,从单表,一对多,多对多,数据绑定,...
scala-activerecord.zip,scala activerecord scalatraactiverecord类似于scala的orm库
活动记录::查看 集成 ActiveRecord 以方便在迁移中轻松使用视图。安装将此行添加到应用程序的 Gemfile 中: gem 'activerecord-view' 然后执行: ... arel_table create_view :authors , users . project ( '*' ) . whe
C# Castle.ActiveRecord CS源码示例教程.zip
Castle ActiveRecord快速入门指南,ActiveRecord帮助文档
ORM的中文教程 英文的API 为什么是2分呢? 因为我很2 -_-!
ActiveRecord最终版,由于ActiveRecord引用了ISet集合,Iesi.Collections.3.4.1.4000以后已经把ISet去掉了,所以ActiveRecord引用的NHibernate的版本的更新只能到3.4.1.4000此为止。 引用其他资源版本如下: ...
Active Record(活动记录),是一种领域模型模式,特点是一个模型类对应关系型数据库中的一个表,而模型类的一个实例对应表中的一行记录。