active_enum 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ [0.9.4] : 2011-09-08
2
+ - Replaced usage of deprecated class_inheritable_accessor with class_attribute.
3
+
1
4
  [0.9.3] : 2011-07-31
2
5
  - Add Railtie for proper loading of ActiveRecord extensions.
3
6
 
@@ -5,7 +5,7 @@ module ActiveEnum
5
5
 
6
6
  def acts_as_enum(options={})
7
7
  extend ClassMethods
8
- class_inheritable_accessor :active_enum_options
8
+ class_attribute :active_enum_options
9
9
  self.active_enum_options = options.reverse_merge(:name_column => 'name')
10
10
  scope :enum_values, select("#{primary_key}, #{active_enum_options[:name_column]}").
11
11
  where(active_enum_options[:conditions]).
@@ -5,8 +5,7 @@ module ActiveEnum
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- class_inheritable_accessor :enumerated_attributes
9
- self.enumerated_attributes = {}
8
+ class_attribute :enumerated_attributes
10
9
  end
11
10
 
12
11
  module ClassMethods
@@ -27,9 +26,9 @@ module ActiveEnum
27
26
  # enumerate :to, :from, :with => Sex
28
27
  #
29
28
  def enumerate(*attributes, &block)
30
- self.enumerated_attributes ||= {}
31
29
  options = attributes.extract_options!
32
30
 
31
+ attributes_enum = {}
33
32
  attributes.each do |attribute|
34
33
  begin
35
34
  if block_given?
@@ -39,7 +38,7 @@ module ActiveEnum
39
38
  end
40
39
 
41
40
  attribute = attribute.to_sym
42
- enumerated_attributes[attribute] = enum
41
+ attributes_enum[attribute] = enum
43
42
 
44
43
  define_active_enum_methods_for_attribute(attribute)
45
44
  rescue NameError => e
@@ -47,6 +46,7 @@ module ActiveEnum
47
46
  raise ActiveEnum::EnumNotFound, "Enum class could not be found for attribute '#{attribute}' in class #{self}. Specify the enum class using the :with option."
48
47
  end
49
48
  end
49
+ self.enumerated_attributes = attributes_enum
50
50
  end
51
51
 
52
52
  def active_enum_for(attribute)
@@ -1,3 +1,3 @@
1
1
  module ActiveEnum
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.4'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_enum
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 3
10
- version: 0.9.3
9
+ - 4
10
+ version: 0.9.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Meehan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-01 00:00:00 +10:00
18
+ date: 2011-09-08 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency