data_columns
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Store multiple columns in serialized data column
= DataColumns
Store multiple columns in serialized data column

== Usage
Create in your model text column data

  create_table  do |t|
    t.text :data
  end

or

  change_table  do |t|
    t.text :data
  end

== Examples
  class Person < ActiveRecord::Base
    data_columns :icq, :skype
    data_columns :phone

    # type triggers standard conversions
    # no type - no conversions
    data_columns :some_time_ago, :type => :time, :default => 1.year.ago
    data_columns :x, :y, :z, :type => 'integer'
    
    validates_presence_of :phone
  end

  Person.create(:icq => '123456789', :skype => 'hello') # gives us error message as phone must be present :)
  
  class Xman < ActiveRecord::Base
    # stores columns in a field called :cached_data instead of default :data
    data_columns :name, :field => :cached_data
  end
  
Copyright (c) 2009 Ivan, released under the MIT license

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。