jt-rails-enum 1.0.3 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4024ed515aba12981e2feb59b1fe25911b876319
4
- data.tar.gz: c17750a2bc8ed308e4441a28aa1a26fbcc39d2dc
3
+ metadata.gz: 9e9cb587aa1433ec78c47a90e179fe76acafb3ec
4
+ data.tar.gz: 1ba0553094b73c504a77b62b330e901c76e742ec
5
5
  SHA512:
6
- metadata.gz: 80c692852997b007ce2febccbf77580ffa54750f5372c4572e04594d69ac064eb95694e25f49a8581f916d3c6901a2712bdc91e9d471d497b268da861de7fc4d
7
- data.tar.gz: 8d5a62333d3b97b66ac9fce1d81d48b7d0fad34bcbb70328e5869d3f4773fedbeeaff721480891c160d4f15f831c489aa23607fa3fe5e6c64f18f6a6ec647ee8
6
+ metadata.gz: a11b132ea8c1bf64a73658049dcab9445f5603b137834221fd10475689df0aa9929d9b8cfed3fda83a762c06890308a0f3f04187a3779c0c18d11544fcf78d12
7
+ data.tar.gz: 27f9d0ff3a6c3158135db6b7fd3ebc30950210ff87024a4a114a409a200a6bab698fed7a9fa13538d4ce089837776f9106735247101b22bc4155f0d581a8a984
data/README.md CHANGED
@@ -33,6 +33,9 @@ Scopes and some basic methods are automatically created for each value in the en
33
33
  # User.where(confirmation_status: User.confirmation_statuses[:waiting]).first
34
34
  user = User.confirmation_status_waiting.first
35
35
 
36
+ # User.where.not(confirmation_status: User.confirmation_statuses[:waiting]).first
37
+ user = User.confirmation_status_not_waiting.first
38
+
36
39
  # Equivalent to user.update!(confirmation_status: User.confirmation_statuses[:accepted])
37
40
  user.confirmation_status_accepted!
38
41
 
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.summary = "JTRailsEnum let you use enum in your models"
4
4
  s.description = "JTRailsEnum let you use enum in your models"
5
5
  s.homepage = 'https://github.com/jonathantribouharet/jt-rails-enum'
6
- s.version = '1.0.3'
6
+ s.version = '1.1.0'
7
7
  s.files = `git ls-files`.split("\n")
8
8
  s.require_paths = ['lib']
9
9
  s.authors = ['Jonathan TRIBOUHARET']
@@ -25,6 +25,7 @@ module JT
25
25
  define_method("#{value_method_name}!") { update! field => i }
26
26
 
27
27
  klass.scope value_method_name, -> { klass.where field => i }
28
+ klass.scope "#{field}_not_#{value}", -> { klass.where.not(field => i) }
28
29
  end
29
30
 
30
31
  validates field, allow_nil: true, inclusion: { in: klass.send(field.to_s.pluralize).values }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jt-rails-enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan TRIBOUHARET
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-14 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: JTRailsEnum let you use enum in your models
14
14
  email: jonathan.tribouharet@gmail.com