{"action":"created","issue":{"url":"https://api.github.com/repos/aasm/aasm/issues/237","labels_url":"https://api.github.com/repos/aasm/aasm/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/aasm/aasm/issues/237/comments","events_url":"https://api.github.com/repos/aasm/aasm/issues/237/events","html_url":"https://github.com/aasm/aasm/issues/237","id":88317323,"number":237,"title":"can't use int type in DB?","user":{"login":"MadisonRong","id":3749639,"avatar_url":"https://avatars.githubusercontent.com/u/3749639?v=3","gravatar_id":"","url":"https://api.github.com/users/MadisonRong","html_url":"https://github.com/MadisonRong","followers_url":"https://api.github.com/users/MadisonRong/followers","following_url":"https://api.github.com/users/MadisonRong/following{/other_user}","gists_url":"https://api.github.com/users/MadisonRong/gists{/gist_id}","starred_url":"https://api.github.com/users/MadisonRong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MadisonRong/subscriptions","organizations_url":"https://api.github.com/users/MadisonRong/orgs","repos_url":"https://api.github.com/users/MadisonRong/repos","events_url":"https://api.github.com/users/MadisonRong/events{/privacy}","received_events_url":"https://api.github.com/users/MadisonRong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aasm/aasm/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/aasm/aasm/labels/persistence","name":"persistence","color":"bfdadc"}],"state":"closed","locked":false,"assignee":{"login":"alto","id":3209,"avatar_url":"https://avatars.githubusercontent.com/u/3209?v=3","gravatar_id":"","url":"https://api.github.com/users/alto","html_url":"https://github.com/alto","followers_url":"https://api.github.com/users/alto/followers","following_url":"https://api.github.com/users/alto/following{/other_user}","gists_url":"https://api.github.com/users/alto/gists{/gist_id}","starred_url":"https://api.github.com/users/alto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alto/subscriptions","organizations_url":"https://api.github.com/users/alto/orgs","repos_url":"https://api.github.com/users/alto/repos","events_url":"https://api.github.com/users/alto/events{/privacy}","received_events_url":"https://api.github.com/users/alto/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2015-06-15T05:04:37Z","updated_at":"2015-10-10T03:49:10Z","closed_at":"2015-10-10T03:49:10Z","body":"I have a field called \"status\" in my DB. Thus, I wanna use AASM without changing structure of my DB.\r\nCan I do that?\r\nhere is my code:\r\n```ruby\r\nclass Card < ActiveRecord::Base\r\n  include AASM\r\n  enum status: {\r\n    default: 0,\r\n    published: 1,\r\n    deleted: 2\r\n  }\r\n\r\n  aasm column: :status, enum: true, skip_validation_on_save: true, no_direct_assignment: true do\r\n    state :default, initial: true\r\n    state :published\r\n    state :deleted\r\n\r\n    event :publish do\r\n      transitions from: :default, to: :published\r\n    end\r\n\r\n    event :delete do\r\n      transitions from: :published, to: :deleted\r\n    end\r\n  end\r\n end\r\n```\r\n\r\nAnd, no matter I called `card.publish` or `card.delete`, I got this error below:\r\n```ruby\r\nNoMethodError: undefined method `name' for nil:NilClass\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/core/state.rb:15:in `=='\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/instance_base.rb:61:in `block in state_object_for_name'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/instance_base.rb:61:in `each'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/instance_base.rb:61:in `find'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/instance_base.rb:61:in `state_object_for_name'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/aasm.rb:62:in `aasm_fire_event'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/persistence/active_record_persistence.rb:175:in `aasm_fire_event'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/aasm-4.1.1/lib/aasm/base.rb:86:in `block in event'\r\n\tfrom (irb):6\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'\r\n\tfrom /Users/MadisonRong/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'\r\n\tfrom bin/rails:4:in `require'\r\n\tfrom bin/rails:4:in `<main>'\r\n```"},"comment":{"url":"https://api.github.com/repos/aasm/aasm/issues/comments/147029931","html_url":"https://github.com/aasm/aasm/issues/237#issuecomment-147029931","issue_url":"https://api.github.com/repos/aasm/aasm/issues/237","id":147029931,"user":{"login":"MadisonRong","id":3749639,"avatar_url":"https://avatars.githubusercontent.com/u/3749639?v=3","gravatar_id":"","url":"https://api.github.com/users/MadisonRong","html_url":"https://github.com/MadisonRong","followers_url":"https://api.github.com/users/MadisonRong/followers","following_url":"https://api.github.com/users/MadisonRong/following{/other_user}","gists_url":"https://api.github.com/users/MadisonRong/gists{/gist_id}","starred_url":"https://api.github.com/users/MadisonRong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MadisonRong/subscriptions","organizations_url":"https://api.github.com/users/MadisonRong/orgs","repos_url":"https://api.github.com/users/MadisonRong/repos","events_url":"https://api.github.com/users/MadisonRong/events{/privacy}","received_events_url":"https://api.github.com/users/MadisonRong/received_events","type":"User","site_admin":false},"created_at":"2015-10-10T03:49:10Z","updated_at":"2015-10-10T03:49:10Z","body":"@anilmaurya yep, you are right. Thanks...."}}