activerecord-metal 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,6 +36,18 @@ module ActiveRecord::Metal::Postgresql
36
36
  def has_index?(name)
37
37
  ask "SELECT 't'::BOOLEAN FROM pg_indexes WHERE indexname=$1", name
38
38
  end
39
+
40
+ def columns
41
+ columns = exec("SELECT attname FROM pg_attribute , pg_type WHERE typrelid=attrelid AND typname=$1", table_name).map(&:first)
42
+
43
+ columns -= %w(tableoid cmax xmax cmin xmin ctid oid)
44
+ columns.select { |column| column !~ /^\.\.\.\.\.\.\.\.pg\.dropped/ }
45
+ end
46
+
47
+ def has_column?(name)
48
+ expect! name => String
49
+ columns.include?(name)
50
+ end
39
51
  end
40
52
 
41
53
  require_relative "postgresql/conversions"
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord; end
2
2
 
3
3
  class ActiveRecord::Metal
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-metal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-20 00:00:00.000000000 Z
12
+ date: 2013-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -64,7 +64,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  segments:
66
66
  - 0
67
- hash: 1704688507352734289
67
+ hash: 522954634217002101
68
68
  required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements: