- 浏览: 145066 次
- 性别:
- 来自: 北京
文章分类
最新评论
转载 :http://blog.csdn.net/meteorlWJ/archive/2008/02/03/2079356.aspx
现在我们有一种新的migration文件中声明的格式。以前我们是这样写的:
Ruby代码 复制代码
而现在,我们可以这样写:
Ruby代码 复制代码
更多关于sexy migration:
现在你只需要这样写:
t.references :account也可以写成 t.belongs_to :account(和ActiveRecord::Base一样)
和ActiveRecord::Base的belongs_to一样,多态也同样支持。
现在我们有一种新的migration文件中声明的格式。以前我们是这样写的:
Ruby代码 复制代码
create_table :people do |t| t.column, "account_id", :integer t.column, "first_name", :string, :null => false t.column, "last_name", :string, :null => false t.column, "description", :text t.column, "created_at", :datetime t.column, "updated_at", :datetime end
而现在,我们可以这样写:
Ruby代码 复制代码
create_table :people do |t| t.integer :account_id t.string :first_name, :last_name, :null => false t.text :description t.timestamps end
更多关于sexy migration:
create_table :people do |t| t.column, “account_id”, :integer t.column, “first_name”, :string, :null => false t.column, “last_name”, :string, :null => false t.column, “description”, :text t.column, “created_at”, :datetime t.column, “updated_at”, :datetime end
现在你只需要这样写:
create_table :people do |t| t.references :account t.string :first_name, :last_name, :null => false t.text :description t.timestamps end
t.references :account也可以写成 t.belongs_to :account(和ActiveRecord::Base一样)
和ActiveRecord::Base的belongs_to一样,多态也同样支持。
create_table :taggings do |t| t.integer :tag_id, :tagger_id, :taggable_id t.string :tagger_type t.string :taggable_type, :default => 'Photo' end
发表评论
-
Google App Engine and others
2010-09-15 11:27 754有用的技术文章 先记载 有空 研究下 さくっとRails ... -
基于jquery和mini_magick的图片裁剪
2010-09-15 11:07 1423引用网址 http://duyouhua1214.iteye ... -
ruby gem相关命令使用
2010-08-26 12:45 1546gem相关命令使用 1.显示gem的帮助和版本 gem – ... -
深入理解alias, alias_method和alias_method_chain
2010-08-06 17:14 934http://blackanger.blog.51cto.co ... -
Rails 3 特点
2010-08-06 16:38 858真的想留下来 http://railslove.com/w ... -
Fix N+1 Queries
2010-08-06 16:16 877http://rails-bestpractices.com/ ... -
query-reviewer sql explain and review in the page
2010-08-06 12:20 1286引用网址 http://github.com/dsboulde ... -
request-log-analyzer log分析工具
2010-08-06 12:03 1565参考网址: http://github.com/wvanber ... -
IE7 Bug导致Rails Session保存失败
2010-08-06 10:56 941http://www.letrails.cn/archives ... -
Rails保存记录而不更新时间戳
2010-08-06 10:54 1310引用地址: http://www.letrails.cn/a ... -
how to generate qrcode on ror
2010-02-04 16:27 8401. In your rails project, in ... -
rmagick ror 上 安装
2009-11-18 09:06 820rmgick 安装规范 ror很多人现在在用了,但是发现 ... -
Update Rails to 2.2.2 (Rails 2.2.2)
2009-03-08 14:53 947gem install -v=2.2.2 rails Suc ... -
Use helpers in controllers or models
2009-01-19 16:22 875引用http://snipplr.com/view/2505/ ... -
open-flash-chart
2008-11-07 14:07 2390http://pullmonkey.com/2008/7/23 ... -
rake db:migrate
2008-11-07 11:58 1239【ruby on rails】rake db:migrate ... -
rss maker
2008-11-07 11:43 1072http://gdgdlog.net/log/show/130 ... -
acts_as_authenticated
2008-11-07 11:35 1051ruby script/plugin install act ... -
validates
2008-11-07 11:24 1030先週ずっとインフルエンザでダウンしてました。 今日はvail ... -
rails で model の変更を監視するプラグイン
2008-11-07 11:12 1331acts_as_modified モデルの変更を監視して、各 ...
相关推荐
ERP升级至S4HANA 第六步:Finance Migration
rails g i18n:active_record:install 它创建一个迁移: class CreateTranslations < ActiveRecord::Migration def self.up create_table :translations do |t| t.string :locale t.string :key
RailsAsyncMigrations ActiveRecord::Migration扩展程序以一种简单直接的方式使您的迁移异步。动机创建该库的目的是为了帮助在技术水平上难以扩展的小型公司。 小型项目不需要异步迁移队列,大公司在遇到扩展问题时...
活动记录会话存储 由Active Record类支持的会话存储。 提供了一个默认类,但是任何使用文本session_id和data... session_store :active_record_store , :key => '_my_app_session' 为了避免会话表无限扩展,因为它会存
gem 'active_record_migrations' gem 'sqlite3' # or 'pg', 'mysql2', ... 然后执行: $ bundle --binstubs 创建一个Rakefile: require 'active_record_migrations' ActiveRecordMigrations.load_tasks 用法 ...
将 MySQL 几何类型添加到 Active Record。 安装 将此行添加到应用程序的 Gemfile 中: gem 'armg' 然后执行: $ bundle 或者自己安装: $ gem install armg 用法 require 'active_record' require 'armg' ...
枚举 具有I18n的枚举属性和ActiveRecord / Mongoid / MongoMapper / Sequel支持... ActiveRecord :: Migration def change create_table :users do | t | t . string :sex t . string :role t . timestamps end endend
手铐 手铐为在应用程序中分阶段运行迁移提供了一种简便的方法。 要进行配置,首先创建一个手铐初始... ActiveRecord :: Migration phase :pre_restart def up add_column :products , :on_sale , :boolean end def down
Spring Migration Anaylzer 是一个用于分析 Java EE 应用程序的命令行工具。 它生成一份报告,描述应用程序以及如何将其迁移到 Spring。 下载 用法 要开始使用迁移分析器,请执行以下操作以获取使用信息: unzip ...
中文汉化版AE超炫粒子插件Trapcode Particular 2.5.1
该工具用于解决sqlserver database 导入mysql的乱码问题,下载该工具:mysql migration toolkit 。该工具支持Oracle,Microsoft SQL Server,Microsoft Access,Sybase,MaxDB到MySQL之间的转换。简单易用的小工具。
Laravel开发-codeigniter_migration CodeIgniterMigration是一个包,用于在Laravel5中集成已启动的CodeIgniter会话。
php-migration 数据库更新维护管理库 如果有以下几种问题,那么你就来对地方了 每次部署程序,都要手动导入数据? 每次数据库字段更新,都要手动去执行一遍? 服务器辣么多,更新数据库要一个一个的手动去执行? ...
Java 9 Revealed is for experienced Java programmers looking to make the migration from Java 7 or Java 8 to Java 9.Author Kishori Sharan begins by covering how to develop Java applications using new ...
建立数据表 php artisan make:migration create_tasks_table --create=tasks 把表写入数据库 php artisan migrate 在生产环境中强制运行迁移,没有提示 php artisan migrate --force
Fresoar Data Migration 2.0 软件产品介绍 Fresoar Data Migration 2.0 (简称FDM 2.0)软件产品作为ETL工具,提供了一套高效、稳定的数据迁移解决方案,我们不只提供软件产品,更重要的我们还提供细致周到的数据迁移...
使用在 Postgres 中创建自动更新物化视图的方法扩展ActiveRecord::Migration 。 可以执行来检查物化视图是否与其非物化版本保持同步。 背景 以下是有关物化视图的一些资源: Dan Chak他的著作Enterprise Rails 中...
MySQL Migration Toolkit 可以将任何数据源转换成mysql的数据,也可以将mysql的数据转换成其它类型的数据 MySQL Migration Toolkit 包括下列转换工具: Access-to-MySQL Access数据库转MySQL数据库 DBF-to-MySQL DBF...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
MySQL Migration Toolkit 2.3版 数据库转化工具下载