has_state_machine 0.4.0 → 0.4.1

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
  SHA256:
3
- metadata.gz: eb504bbd9b6e978b3a62551273a74624cdb4d189545cb32bf45a7f060983e888
4
- data.tar.gz: ac89964cd89cec827ac60c8fae3970d94329c0141c0078da7a409ff2f63547ff
3
+ metadata.gz: 58bd21a655ff20122628fbc9707b04d77be5a318753cabb721c16073ad9d7edb
4
+ data.tar.gz: ee6c83c9b070867c9715b9dc3970597f9c5db61ae616839f2bd3841bd397b501
5
5
  SHA512:
6
- metadata.gz: e62938a674ba7e8bea155e536724220280458a32bfa4dc3bdeed402bba4067a54b253b76f017fec7a25b361e349b92d88daf00d8071464bc72814f96e1ae152d
7
- data.tar.gz: cfc4cf9a5b21dc548cc4207979ac1325e5134dfe6d4fd3114ca6d623ac22ca8afcdc899cfea192030986f7ab42268405ebd6edc7201fab976752d9d6447879f9
6
+ metadata.gz: ce2c67a3440e3175693e589188456434ac593c3f219abcdb9607f7f2241a00e51746764c5b17623c66259f9bc6fdb3e1de8547262da27c93d16adefdf090b130
7
+ data.tar.gz: da2d558bc3dbd3686ce46538bd426956c5664a3f608350007643ae53626eae944f95c5d6180ca42b39459006bbd4084faf7b58d1a6354d262119d64718f16eac
@@ -36,28 +36,28 @@ module HasStateMachine
36
36
  def define_helper_methods(states:, options:)
37
37
  ##
38
38
  # The list of possible states in the state machine.
39
- define_singleton_method "workflow_states" do
39
+ define_singleton_method :workflow_states do
40
40
  states
41
41
  end
42
42
 
43
43
  ##
44
44
  # Defines the column name for the attribute holding the current status.
45
45
  # Can be overwritten to use a different column name.
46
- define_singleton_method "state_attribute" do
46
+ define_singleton_method :state_attribute do
47
47
  options[:state_attribute]&.to_sym || :status
48
48
  end
49
49
 
50
50
  ##
51
51
  # Defines the namespace of the models possible states.
52
52
  # Can be overwritten to use a different namespace.
53
- define_singleton_method "workflow_namespace" do
53
+ define_singleton_method :workflow_namespace do
54
54
  (options[:workflow_namespace] || "Workflow::#{self}")
55
55
  end
56
56
 
57
57
  ##
58
58
  # Determines whether or not the state validations should be run
59
59
  # as part of the object validations; they are by default.
60
- define_singleton_method "state_validations_on_object?" do
60
+ define_singleton_method :state_validations_on_object? do
61
61
  return true unless options.key?(:state_validations_on_object)
62
62
 
63
63
  options[:state_validations_on_object]
@@ -56,7 +56,7 @@ module HasStateMachine
56
56
  # > Post.published.where(user: user)
57
57
  # #=> [#<Post>]
58
58
  if defined?(ActiveRecord) && (self < ActiveRecord::Base)
59
- scope state, -> { where("#{state_attribute} = ?", state) }
59
+ scope state, -> { where("#{table_name}.#{state_attribute} = ?", state) }
60
60
  end
61
61
 
62
62
  ##
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HasStateMachine
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_state_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Hargett
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-04-03 00:00:00.000000000 Z
12
+ date: 2023-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.1.4
137
+ rubygems_version: 3.1.6
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Class based state machine for ActiveRecord models.