transitions 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.8
2
+
3
+ * (phillipp | Phillipp Röll) Fixes a wrong select for scopes if the state machines attribute_name is set to something other than the default
4
+
1
5
  # 1.0.7
2
6
 
3
7
  * (cmw) Better prevention of name clashes when creating initializer methods
@@ -102,7 +102,7 @@ module Transitions
102
102
  if @klass.respond_to?(state_name)
103
103
  raise InvalidMethodOverride, "Transitions: Can not define scope `#{state_name}` because there is already an equally named method defined - either rename the existing method or the state."
104
104
  end
105
- @klass.scope state_name, @klass.where(:state => state_name)
105
+ @klass.scope state_name, @klass.where(@klass.state_machine.attribute_name => state_name)
106
106
  end
107
107
  end
108
108
  end
@@ -1,3 +1,3 @@
1
1
  module Transitions
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -19,7 +19,7 @@ end
19
19
  class CreateBunnies < ActiveRecord::Migration
20
20
  def self.up
21
21
  create_table(:bunnies, :force => true) do |t|
22
- t.string :state
22
+ t.string :status # Explicitly use another state column to ensure that this whole enchilada is working with other state column names than the default ones.
23
23
  end
24
24
  end
25
25
  end
@@ -29,7 +29,7 @@ set_up_db CreateBunnies, CreatePuppies
29
29
  class Bunny < ActiveRecord::Base
30
30
  include ActiveModel::Transitions
31
31
 
32
- state_machine :auto_scopes => true do
32
+ state_machine :attribute_name => :status, :auto_scopes => true do
33
33
  state :hobbling
34
34
  end
35
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transitions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-07 00:00:00.000000000 Z
13
+ date: 2013-03-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -179,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  segments:
181
181
  - 0
182
- hash: 316655379
182
+ hash: 604342113
183
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements: