【文件属性】:
文件名称:activerecord_strict_validations:活动记录
文件大小:16KB
文件格式:ZIP
更新时间:2021-06-21 13:08:06
Ruby
ActiveRecord::StrictValidations
ActiveRecord::StrictValidations向 ActiveRecord 模型添加验证以确保它们不会触发数据库错误。
安装
将此行添加到应用程序的 Gemfile 中:
gem 'activerecord_strict_validations'
用法
create_table "events" do | t |
t . string "name"
t . string "email" , limit : 128
t . text "description"
t . integer "people_count"
end
class Event < ActiveRecord :: Base
validates_strict_columns
end
# String c
【文件预览】:
activerecord_strict_validations-master
----.gitignore(154B)
----README.md(3KB)
----gemfiles()
--------Gemfile.activerecord-3.2.x(83B)
--------Gemfile.activerecord-4.0(83B)
----Gemfile(38B)
----.rspec(9B)
----LICENSE.md(1KB)
----spec()
--------support()
--------activerecord_mysql_strict_spec.rb(756B)
--------activerecord_mysql_strict()
--------spec_helper.rb(556B)
----.travis.yml(178B)
----activerecord_strict_validations.gemspec(1KB)
----lib()
--------active_record()
--------activerecord_strict_validations.rb(698B)
----Rakefile(219B)