Sha256: b651ccafb5b0e9df3c2450d7211818f0a3bd7ab59056c12ef806d8bc88004bf4

Contents?: true

Size: 559 Bytes

Versions: 64

Compression:

Stored size: 559 Bytes

Contents

class User
  include DataMapper::Resource
  
  property :id, Serial
  property :name, String
  
  validates_present :name, :state, :access_state
  
  state_machine :initial => :unregistered do
    event :register do
      transition :unregistered => :registered
    end
    
    event :unregister do
      transition :registered => :unregistered
    end
  end
  
  state_machine :access_state, :initial => :enabled do
    event :enable do
      transition all => :enabled
    end
    
    event :disable do
      transition all => :disabled
    end
  end
end

Version data entries

64 entries across 64 versions & 15 rubygems

Version Path
state_machine-0.9.2 examples/merb-rest/model.rb
state_machine-0.9.1 examples/merb-rest/model.rb
state_machine-0.9.0 examples/merb-rest/model.rb
branston-0.6.0 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
state_machine-0.8.1 examples/merb-rest/model.rb
branston-0.5.2 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.5.1 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.5.0 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
mattscilipoti-state_machine-0.8.0.1 examples/merb-rest/model.rb
branston-0.4.6 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.4.5 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.4.4 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.4.3 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.4.2 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.4.1 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
branston-0.4.0 lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb
state_machine-0.8.0 examples/merb-rest/model.rb
state_machine-0.7.6 examples/merb-rest/model.rb
state_machine-0.7.4 examples/merb-rest/model.rb
state_machine-0.7.2 examples/merb-rest/model.rb