Sha256: 13efdda9643b5bf399dcc95fb85f1d6493d64e6ec0a14967e0b779166211b0c3
Contents?: true
Size: 322 Bytes
Versions: 4
Compression:
Stored size: 322 Bytes
Contents
module RC module Presence include ActiveRecord::ConnectionAdapters::Quoting def add_presence_constraint(table, attribute) name = "#{table}_#{attribute}" conditions = "#{attribute} !~ '^\s*$'" execute("ALTER TABLE #{table} ADD CONSTRAINT #{name} CHECK (#{conditions})") end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rein-0.8.3 | lib/rein/constraint/presence.rb |
rein-0.8.2 | lib/rein/constraint/presence.rb |
rein-0.8.1 | lib/rein/constraint/presence.rb |
rein-0.8.0 | lib/rein/constraint/presence.rb |