title: undefined method `to_sym' for nil:NilClass after migration
body: <p>I am following this <a href="https://github.com/RolifyCommunity/rolify/wiki/Tutorial" rel="nofollow">Rolify Tutorial</a> using devise, cancan, and rolify in a Rails project. After creating a new migration (that works fine), I'm getting this error:</p>
  
  <blockquote>
    <p>undefined method `to_sym' for nil:NilClass</p>
  </blockquote>
  
  <p>I don't know what I'm doing bad. This is my debug.</p>
  
  <p><strong>My migration for alter the users table is:</strong></p>
  
  <pre><code>class AlterUsersTable1 &lt; ActiveRecord::Migration
    def up
      change_table :users, :id =&gt; true do |t|
        t.references :genre, :null =&gt; false, :default =&gt; 1
        t.string :first_name, :null =&gt; false, :default =&gt; ''
        t.string :last_name, :null =&gt; false, :default =&gt; ''
        t.string :company, :null =&gt; true
        t.boolean :status, :null =&gt; false, :default =&gt; true
    end
  
    execute &lt;&lt;-SQL
      ALTER TABLE users 
      ADD CONSTRAINT fk_users_genre
      FOREIGN KEY (genre_id) 
      REFERENCES genres(id)
    SQL
  
    execute &lt;&lt;-SQL
      ALTER TABLE users 
      DROP PRIMARY KEY, ADD PRIMARY KEY (id, genre_id)    
    SQL
  end
  
  # RESET THE TABLE
  def down
    execute &lt;&lt;-SQL
      ALTER TABLE users 
      DROP FOREIGN KEY fk_users_genre
    SQL
  
    execute &lt;&lt;-SQL
      ALTER TABLE users
      DROP PRIMARY KEY, ADD PRIMARY KEY (id)    
    SQL
  
    remove_column :users, :first_name
    remove_column :users, :last_name
    remove_column :users, :company
    remove_column :users, :status
    remove_column :users, :genre_id
  end
  end
  </code></pre>
  
  <p><strong>My routes file is:</strong></p>
  
  <pre><code>  devise_for :users
    resources :users
    resources :categories
    root :to =&gt; 'home#index'
  </code></pre>
  
  <p><strong>The application_controller.rb</strong></p>
  
  <pre><code>  before_filter :authenticate_user!
  </code></pre>
  
  <p><strong>This my trace</strong></p>
  
  <pre><code>activerecord (3.2.19) lib/active_record/sanitization.rb:60:in `block in expand_hash_conditions_for_aggregates'
  activerecord (3.2.19) lib/active_record/sanitization.rb:59:in `each'
  activerecord (3.2.19) lib/active_record/sanitization.rb:59:in `expand_hash_conditions_for_aggregates'
  activerecord (3.2.19) lib/active_record/relation/query_methods.rb:326:in `build_where'
  activerecord (3.2.19) lib/active_record/relation/query_methods.rb:136:in `where'
  activerecord (3.2.19) lib/active_record/querying.rb:9:in `where'
  orm_adapter (0.5.0) lib/orm_adapter/adapters/active_record.rb:17:in `get'
  devise (3.2.2) lib/devise/models/authenticatable.rb:208:in `serialize_from_session'
  devise (3.2.2) lib/devise.rb:462:in `block (2 levels) in configure_warden!'
  warden (1.2.3) lib/warden/session_serializer.rb:34:in `fetch'
  warden (1.2.3) lib/warden/proxy.rb:212:in `user'
  warden (1.2.3) lib/warden/proxy.rb:318:in `_perform_authentication'
  warden (1.2.3) lib/warden/proxy.rb:104:in `authenticate'
  warden (1.2.3) lib/warden/proxy.rb:114:in `authenticate?'
  devise (3.2.2) app/controllers/devise_controller.rb:103:in `require_no_authentication'
  activesupport (3.2.19) lib/active_support/callbacks.rb:407:in `_run__584588561542237872__process_action__1933424417154408597__callbacks'
  activesupport (3.2.19) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.19) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.19) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.19) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.19) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.19) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.19) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.19) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.19) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.19) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.19) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.19) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.19) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.19) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.19) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.19) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.19) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.19) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.19) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.19) lib/action_dispatch/routing/route_set.rb:36:in `call'
  actionpack (3.2.19) lib/action_dispatch/routing/mapper.rb:43:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.19) lib/action_dispatch/routing/route_set.rb:608:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.19) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.19) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.19) lib/active_support/callbacks.rb:405:in `_run__3633975209017476260__call__1066395091297338092__callbacks'
  activesupport (3.2.19) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.19) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.19) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.19) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.19) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.19) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.19) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.19) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.19) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.19) lib/action_dispatch/middleware/static.rb:63:in `call'
  railties (3.2.19) lib/rails/engine.rb:484:in `call'
  railties (3.2.19) lib/rails/application.rb:231:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.19) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
  /Users/oscar/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/oscar/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/oscar/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
  </code></pre>