0

I am trying to set up Pageflow. Finally I managed to create DBs and install pageflow. I can run rails s but I get Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue. in my browser.

Anyway, typing bundle exec rake db:create db:migrate would give me this error:

==  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'

This line in schema_statements says.

 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

end

I tried to solve this with the gem composite-primary-keys, but found out that there is no compatible version for rails 4.0.2.

Being an absolute noob, I found the issue here: https://github.com/composite-primary-keys/composite_primary_keys/issues/174 but it didn't helped me out.

Thanks!

//EDIT

Thats my 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

There is no extra comma at the end...

maschino
  • 41
  • 5
  • Please post the devise model or User model. – raj_on_rails Jan 28 '15 at 15:34
  • Sorry, which file would that be? – maschino Jan 28 '15 at 16:51
  • I think in **app -> models -> user.rb or devise.rb**, you put an extra comma. Ex: ' devise :ldap_authenticatable, :rememberable, :trackable, '. If this is the case, remove comma at the last. – raj_on_rails Jan 28 '15 at 17:04
  • Do you have a `User` model in your rails application? – nathanvda Jan 28 '15 at 22:51
  • Could you paste the AddDeviseToUsers migration. Looks like it is passing an options hash (i.e. `{:null => false ...}`) where AR expects a type (i.e. `:string` etc.). Also why do have two devise declarations in your user.rb? Maybe you tried to install devise into an application that already inlcuded devise? – tfischbach Feb 05 '15 at 18:22

0 Answers0