ar_properties 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,15 +15,20 @@ module ActiveRecord
15
15
 
16
16
  module ClassMethods
17
17
  def columns
18
- @columns ||= properties.map(&:to_column)
18
+ @columns ||= properties.values.map(&:to_column)
19
19
  end
20
20
 
21
21
  def properties
22
- @properties ||= []
22
+ @properties ||= {}
23
23
  end
24
24
 
25
25
  def property(*args)
26
- Property.new(connection, *args).tap {|x| properties << x }
26
+ Property.new(connection, *args).tap {|x| properties[x.name.to_s] = x }
27
+ end
28
+
29
+ def belongs_to(*a, &b)
30
+ property "#{a.first}_id", :integer
31
+ super
27
32
  end
28
33
 
29
34
  def timestamps(suffix=:at)
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Properties
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_properties
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-02 00:00:00.000000000 Z
13
+ date: 2012-05-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord