【文件属性】:
文件名称:classy_attribute:给你的 ActiveRecord 属性一些类
文件大小:4KB
文件格式:ZIP
更新时间:2021-07-01 03:02:47
Ruby
类属性
给你的 ActiveRecord 属性一些类。
ClassyAttribute 提供了一种用功能丰富的域对象包装 ActiveRecord 属性的简单方法。 它适用于String 、 Numeric 、 Date以及可以在您的数据库中本地表示的任何其他 Ruby 类型。
警告:在v1.0.0发布之前,请将此代码v1.0.0实验性代码。
安装
将此行添加到应用程序的 Gemfile 中:
gem 'classy_attribute'
然后执行:
$ bundle
或者自己安装:
$ gem install classy_attribute
用法
将 ClassyAttribute 与ActiveRecord#serialize结合使用。
在您的模型类中:
class User < ActiveRecord :: Base
serialize :email
【文件预览】:
classy_attribute-master
----LICENSE.txt(1KB)
----classy_attribute.gemspec(994B)
----lib()
--------classy_attribute()
--------classy_attribute.rb(701B)
----Gemfile(101B)
----Rakefile(29B)
----README.md(2KB)