I am trying Devise, going through the tutorials, up through creating the
user table with rails g devise user… and rake db:migrate
When I go to localhost:3000/users/sign_up I am getting the following
error:
Could not find table ‘users’
Here is a dump of the schema:
ActiveRecord::Schema.define(version: 0) do
end
Looks like something went wrong with the user table creation. Seems
pretty straight forward. Any help appreciated.
Thanks in advance,
Here is my gemfile: (I am on Ruby 1.9.3 if that makes a difference)
source ‘https://rubygems.org’
Bundle edge Rails instead: gem ‘rails’, github: ‘rails/rails’
gem ‘rails’, ‘4.1.0’
gem ‘zurb-foundation’
gem ‘devise’
Use sqlite3 as the database for Active Record
gem ‘sqlite3’
Use SCSS for stylesheets
gem ‘sass-rails’, ‘~> 4.0.3’
Use Uglifier as compressor for JavaScript assets
gem ‘uglifier’, ‘>= 1.3.0’
Use CoffeeScript for .js.coffee assets and views
gem ‘coffee-rails’, ‘~> 4.0.0’
runtimes
gem ‘therubyracer’, platforms: :ruby
Use jquery as the JavaScript library
gem ‘jquery-rails’
Turbolinks makes following links in your web application faster. Read
more: GitHub - turbolinks/turbolinks-classic: Classic version of Turbolinks. Now deprecated in favor of Turbolinks 5.
gem ‘turbolinks’
Build JSON APIs with ease. Read more:
gem ‘jbuilder’, ‘~> 2.0’
bundle exec rake doc:rails generates the API under doc/api.
gem ‘sdoc’, ‘~> 0.4.0’, group: :doc
Use ActiveModel has_secure_password
gem ‘bcrypt’, ‘~> 3.1.7’
Use unicorn as the app server
gem ‘unicorn’
Use Capistrano for deployment
gem ‘capistrano-rails’, group: :development
Use debugger
gem ‘debugger’, group: [:development, :test]
Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem ‘tzinfo-data’, platforms: [:mingw, :mswin]
It seems that your rake migrate was unsuccessfully created.
Have a look in the db/migrate folder and see if there is any migration
file!?
Here is the migration file that rails g devise user created:
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => “”
t.string :encrypted_password, :null => false, :default => “”
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, :default => 0 # Only if lock
strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or
:both
# t.datetime :locked_at
## Token authenticatable
# t.string :authentication_token
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
# add_index :users, :authentication_token, :unique => true
end
end
*** Mateus *** wrote in post #1143092:
It seems that your rake migrate was unsuccessfully created.
Have a look in the db/migrate folder and see if there is any migration
file!?
On 15 April 2014 03:43, Slavko V. [email protected] wrote:
Here is the migration file that rails g devise user created:
What is the name of the migration file, and what happens if you run
rake db:migrate again (copy/paste the result here).
Colin
It seems Devise generator creates .txt file, instead of .rb file. Change
migration file to .rb and run rake db:migrate.
Thank you ! Yes, this was the issue. The migration file created by
Devise did not have the rb file extension.
Colin L. wrote in post #1143108:
On 15 April 2014 03:43, Slavko V. [email protected] wrote:
Here is the migration file that rails g devise user created:
What is the name of the migration file, and what happens if you run
rake db:migrate again (copy/paste the result here).
Colin
Are you able to do anything with User in console mode(rails c) ?
Is that the only table you have problem creating?
Well. If you following exactly as it is in the tutorial, it might be
some database issue such as authentication.
Also, how’s your development.log? Didn’t show anything that could be
relevant to the problem?!
Sent from my iPhone