Sha256: 34ca8aed21e27f98faea620d2c65ec65596b076f61ae86991e78c35ee4379129
Contents?: true
Size: 626 Bytes
Versions: 8
Compression:
Stored size: 626 Bytes
Contents
class Timestamp < ActiveRecord::Base class << self def create_table self.connection.create_table(:timestamps) do |t| t.integer :timestampable_id t.string :timestampable_type t.string :key t.datetime :stamped_at t.timestamps end end def drop_table self.connection.drop_table(:timestamps) end end belongs_to :timestampable, :polymorphic => true validates_presence_of :key, :timestampable_id, :timestampable_type validates_uniqueness_of :key, :scope => [ :timestampable_id, :timestampable_type ] def to_param self.key end end
Version data entries
8 entries across 8 versions & 1 rubygems