has_constant 0.5.0 → 0.5.1

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.
Files changed (4) hide show
  1. data/README.rdoc +14 -3
  2. data/VERSION +1 -1
  3. data/has_constant.gemspec +1 -1
  4. metadata +3 -3
data/README.rdoc CHANGED
@@ -14,7 +14,6 @@ translations in your de locale file. Also, you must always add any new values t
14
14
 
15
15
  class User < ActiveRecord::Base
16
16
  include HasConstant
17
- include HasConstant::Orm::ActiveRecord
18
17
 
19
18
  has_constant :salutations, lambda { I18n.t(:salutations) }
20
19
  end
@@ -37,7 +36,6 @@ u.salutation #=> 'Frau'
37
36
  === with ActiveRecord
38
37
  class User < ActiveRecord::Base
39
38
  include HasConstant
40
- include HasConstant::Orm::ActiveRecord
41
39
 
42
40
  has_constant :salutations, ['Mr', 'Mrs']
43
41
  end
@@ -57,13 +55,26 @@ u.salutation #=> 'Mr'
57
55
  class User
58
56
  include Mongoid::Document
59
57
  include HasConstant
60
- include HasConstant::Orm::Mongoid
61
58
 
62
59
  has_constant :industries, ['IT/Development', 'Marketing']
63
60
  end
64
61
 
65
62
  User.industries #=> ['IT/Development', 'Marketing']
66
63
 
64
+ to index the values for querying just add :index => true
65
+
66
+ === defaults to use translation file
67
+
68
+ assuming I18n.t(:salutations) == ['Mr', 'Mrs']
69
+
70
+ class User
71
+ include Mongoid::Document
72
+
73
+ has_constant :salutations
74
+ end
75
+
76
+ User.salutations #=> ['Mr', 'Mrs']
77
+
67
78
  === without a database
68
79
 
69
80
  class User
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
data/has_constant.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_constant}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mattbeedle"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_constant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - mattbeedle