enumerize 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.0.4 (February 8, 2012) ##
2
+
3
+ ### bug fix
4
+ * Make attribute accessors to work with ActiveRecord 3.1.x (by @lest)
5
+
1
6
  ## 0.0.3 (February 8, 2012) ##
2
7
 
3
8
  ### enhancements
@@ -37,8 +37,8 @@ module Enumerize
37
37
  def _define_enumerize_attribute(mod, attr)
38
38
  mod.module_eval <<-RUBY, __FILE__, __LINE__ + 1
39
39
  def #{attr.name}
40
- if defined?(super)
41
- self.class.#{attr.name}.find_value(super)
40
+ if respond_to?(:read_attribute, true)
41
+ self.class.#{attr.name}.find_value(read_attribute(:#{attr.name}))
42
42
  else
43
43
  if defined?(@#{attr.name})
44
44
  self.class.#{attr.name}.find_value(@#{attr.name})
@@ -49,8 +49,8 @@ module Enumerize
49
49
  end
50
50
 
51
51
  def #{attr.name}=(new_value)
52
- if defined?(super)
53
- super self.class.#{attr.name}.find_value(new_value).to_s
52
+ if respond_to?(:write_attribute, true)
53
+ write_attribute :#{attr.name}, self.class.#{attr.name}.find_value(new_value).to_s
54
54
  else
55
55
  @#{attr.name} = self.class.#{attr.name}.find_value(new_value).to_s
56
56
  end
@@ -1,3 +1,3 @@
1
1
  module Enumerize
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -49,5 +49,6 @@ describe Enumerize::Integrations::ActiveRecord do
49
49
 
50
50
  it 'has default value' do
51
51
  User.new.role.must_equal 'user'
52
+ User.new.attributes['role'].must_equal 'user'
52
53
  end
53
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &23049480 !ruby/object:Gem::Requirement
16
+ requirement: &22484160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 3.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *23049480
24
+ version_requirements: *22484160
25
25
  description: Enumerated attributes with I18n and ActiveRecord support
26
26
  email: info@twinslash.com
27
27
  executables: []
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  segments:
65
65
  - 0
66
- hash: 1283897538830316283
66
+ hash: 375391047734641899
67
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  segments:
74
74
  - 0
75
- hash: 1283897538830316283
75
+ hash: 375391047734641899
76
76
  requirements: []
77
77
  rubyforge_project:
78
78
  rubygems_version: 1.8.15