0
votes

-- create_table(:admin_users) rake aborted! An error has occurred, this and all later migrations canceled:

undefined method `database_authenticatable' for #

Tasks: TOP => db:migrate How to solv it? Thanx!

migration

create_table(:admin_users) do |t|
      t.database_authenticatable :null => false
      t.recoverable
      t.rememberable
      t.trackable
      t.timestamps
end

have all gems in gemfile and installed

4
What does the migration look like?GorrillaMcD

4 Answers

1
votes

Make sure you have devise in the Gemfile and the bundle is installed.

1
votes

Answer is simple device team sucks!!! to solve this need make cnanges in GEMFILE gem 'devise', "~> 1.5"

because in 1.5 there is database_authenticatable type support and in 2.1.0 there is support of only compatibility not creation of fields with this type thanx everybody.

1
votes

If you're just getting started with devise (vs updating from previous verions), you might have missed the following step before doing rake db:migrate

rails generate devise:install

This creates

create  config/initializers/devise.rb
create  config/locales/devise.en.yml

which define the method rake is complaining about above.

Source: https://github.com/plataformatec/devise

0
votes

With Devise 2.0 and newer, the migration helper methods (t.database_authenticatable for example) are not available (as stated on the wiki here ) If you're making a new model for users, just use the devise migration generator like so:

rails g devise admin_users (If you're installing devise on your app)

If you're adding the required fields to an existing user model, you should check this page on the devise wiki.

Check out the main README for devise, which has up-to-date information for installing the latest version of devise on Rails.