activerecord-collections 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e28b341879dd707e39def6507399f1234cb6a192
4
- data.tar.gz: 0fb3b1b2f1903ace1d9c854e6e8590fa51e15ba5
3
+ metadata.gz: 2d8c2bbbd91158545724fa1361d374e189c81411
4
+ data.tar.gz: d9a9667c551a532fe1112eaf48bceb7e787b0dcd
5
5
  SHA512:
6
- metadata.gz: 653911ecdedb4836c23db84d81846a34ce7dcac70f9497d3e58282f9cb5130e10617e0b84a357dbdb4721ffb456c07992516138350e53883c62bf616a98374dc
7
- data.tar.gz: 1e7f93b059c156f7281abb62f42e35738ae74ea4efa3dc0cc5edd5dfef8bb070c857f5e76b981fa381b0b08d7aceb48e88d505f8f001589e942eb8ec892e7a7f
6
+ metadata.gz: ccfc65a4b4b05ab59d90579937cd461f71edd783da29c5562ae340dad2d0c53089ee355f8fbee68409dafd728bf91b8d0e960c6da8be7253b35fceffc49d7161
7
+ data.tar.gz: 121f1d0935db26f71bafc0994d22f632d066e421fa50aae716d30633f7db02f053ebf9e1656e5f1dbe135b3a4aedc85d311d3e4ba5079ef7e1eb00a1a0d2dda3
@@ -9,6 +9,7 @@ module ActiveRecord
9
9
  attr_reader :relation, :options
10
10
 
11
11
  class << self
12
+ attr_accessor :kollektable
12
13
  attr_reader :collections
13
14
  def inherited(subclass)
14
15
  (@collections ||= []) << subclass
@@ -17,20 +18,20 @@ module ActiveRecord
17
18
  def collectable(klass=nil)
18
19
  unless klass.nil?
19
20
  raise ArgumentError, "The collection model must inherit from ActiveRecord::Base" unless klass.ancestors.include?(ActiveRecord::Base)
20
- @collectable = klass
21
+ self.kollektable = klass
21
22
  end
22
23
 
23
- if @collectable.nil?
24
+ if self.kollektable.nil?
24
25
  begin
25
26
  klass = self.name.demodulize.singularize.constantize
26
- @collectable = klass if !klass.nil?# && klass.ancestors.include?(ActiveRecord::Base)
27
+ self.kollektable = klass if !klass.nil? && klass.ancestors.include?(ActiveRecord::Base)
27
28
  rescue
28
29
  # singularized class doesn't exist
29
30
  end
30
31
  end
31
32
 
32
- raise "Unable to determine a model to use for your collection, please set one with the `collectable` class method" if @collectable.nil? # TODO implement real exceptions
33
- @collectable
33
+ raise "Unable to determine a model to use for your collection, please set one with the `collectable` class method" if self.kollektable.nil? # TODO implement real exceptions
34
+ self.kollektable
34
35
  end
35
36
  alias_method :model, :collectable
36
37
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Collections
3
- VERSION = '0.0.20'
3
+ VERSION = '0.0.21'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-collections
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rebec