Получение неопределенного метода to_sym во время миграции при настройке Devise

Я пытаюсь настроить Pageflow. Наконец мне удалось создать БД и установить pageflow. я могу бежать rails s но я получаю Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue. в моем браузере.

Во всяком случае, набрав bundle exec rake db:create db:migrate дал бы мне эту ошибку:

==  AddDeviseToUsers: migrating ===============================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

undefined method `to_sym' for {:null=>false, :default=>""}:Hash/Users/user/.gem/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:671:in `type_to_sql'

Эта строка в schema_statements говорит.

 def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
    if native = native_database_types[type.to_sym]
      column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup

  if type == :decimal # ignore limit, use precision and scale
    scale ||= native[:scale]

    if precision ||= native[:precision]
      if scale
        column_type_sql << "(#{precision},#{scale})"
      else
        column_type_sql << "(#{precision})"
      end
    elsif scale
      raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale is specified"
    end

  elsif (type != :primary_key) && (limit ||= native.is_a?(Hash) && native[:limit])
    column_type_sql << "(#{limit})"
  end

  column_type_sql
else
  type
end

конец

Я попытался решить эту проблему с помощью составного-первичного ключа gem, но обнаружил, что не существует совместимой версии для rails 4.0.2.

Будучи абсолютным новичком, я нашел проблему здесь: https://github.com/composite-primary-keys/composite_primary_keys/issues/174 но это не помогло мне.

Спасибо!

//РЕДАКТИРОВАТЬ

Вот мой user.rb:

    class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, 
         :recoverable, :rememberable, :trackable, :validatable
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, 
         :recoverable, :rememberable, :trackable, :validatable

  include Pageflow::UserMixin
end

В конце нет лишней запятой...

0 ответов

Другие вопросы по тегам