enumerations 2.2.2 → 2.2.3

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: 2df0679b8e64a8f5308716c2267da923343c3e25
4
- data.tar.gz: 94e557e82f4a8e4b0b14c3c353e1a35c59041253
3
+ metadata.gz: 6bff6ddbd1cfb803b3463c11796daf3c81f1c741
4
+ data.tar.gz: 20a258a2ed4129ed92b044f2933fb366d45aba6e
5
5
  SHA512:
6
- metadata.gz: 487e7348405aa95e9cdbc1fa481b8bcf792aa991bcd34b0eebc4bdded31ccca85ec9d517b2fec77c9f133948f068e8d85095d832881c1203fe135515b6b8c9d5
7
- data.tar.gz: 570bf8b1f44b99ec33c194dd9fc68b40c7cf3f6cf6e154e2d38d1229fc596c817dfdbc8a3ab065e7cf5ee6c60f1e91997f8a536e68587a01a5a9a64fe770e220
6
+ metadata.gz: 584c186148b1038d4aadbdd1ee4cb230ee32b40332aca1888933a2ac2813ad61dd356eb548701ab52a10a9e426122ba70e6022cc6254001431b3fd2e51c3d198
7
+ data.tar.gz: 7048a1acf02560a3311d3956d09ce76d25651a631bf7b4a169d7513d28f4f656142ec93a0f44fff6667022d8651f07cdc81104b2eab969c5dabb0468c65bc72e
@@ -65,8 +65,8 @@ module Enumerations
65
65
  end
66
66
 
67
67
  def translate_attribute(key, locale)
68
- I18n.t(key, scope: [:enumerations, self.class.name.underscore, symbol],
69
- default: @attributes[key],
68
+ I18n.t(key, scope: [:enumerations, self.class.name.demodulize.underscore, symbol],
69
+ default: @attributes[key].to_s,
70
70
  locale: locale)
71
71
  end
72
72
 
@@ -1,3 +1,3 @@
1
1
  module Enumerations
2
- VERSION = '2.2.2'.freeze
2
+ VERSION = '2.2.3'.freeze
3
3
  end
@@ -19,10 +19,10 @@ class Status < Enumerations::Base
19
19
  end
20
20
 
21
21
  class Role < Enumerations::Base
22
- value :admin, name: 'Admin', admin: true, active: true
23
- value :editor, name: 'Editor', admin: true, active: false, description: 'Edits newspapers'
24
- value :author, name: 'Author'
25
- value :lecturer
22
+ value :admin, name: 'Admin', admin: true, active: true
23
+ value :editor, name: 'Editor', admin: true, active: false, description: 'Edits newspapers'
24
+ value :author, name: 'Author'
25
+ value :lecturer, type: :croatist
26
26
 
27
27
  def my_custom_name
28
28
  ['user', name].join('_')
@@ -62,4 +62,10 @@ class ValueTest < Minitest::Test
62
62
 
63
63
  assert_equal status.to_param, 'draft'
64
64
  end
65
+
66
+ def test_enumeration_when_attribute_value_is_symbol
67
+ role = Role.find(:lecturer)
68
+
69
+ assert_equal role.type, 'croatist'
70
+ end
65
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project:
173
- rubygems_version: 2.5.1
173
+ rubygems_version: 2.6.8
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Enumerations for ActiveRecord!