Ruby on rails Rails 6,Desive什么也没做

Ruby on rails Rails 6,Desive什么也没做,ruby-on-rails,ruby,authentication,devise,ruby-on-rails-6,Ruby On Rails,Ruby,Authentication,Devise,Ruby On Rails 6,rails新手在此使用Desive为我的rails 6应用程序创建用户 我遵循了这里概述的步骤:但是当我尝试登录到我的应用程序时,登录按钮没有任何作用(当然是使用有效的凭证)。在我的日志中没有发生任何事情,因此没有什么有趣的东西可以展示。注册新用户时,注册按钮也会出现这种情况 我已经浏览了许多其他SO页面,但它们都是过去的,我想知道Rails6是否有不同的解决方案 以下是一些相关代码: app/models/user.rb: class User < ApplicationRecord

rails新手在此使用Desive为我的rails 6应用程序创建用户

我遵循了这里概述的步骤:但是当我尝试登录到我的应用程序时,
登录
按钮没有任何作用(当然是使用有效的凭证)。在我的日志中没有发生任何事情,因此没有什么有趣的东西可以展示。注册新用户时,
注册
按钮也会出现这种情况

我已经浏览了许多其他SO页面,但它们都是过去的,我想知道Rails6是否有不同的解决方案

以下是一些相关代码:

app/models/user.rb:

class User < ApplicationRecord
  has_many :user_stocks
  has_many :stocks, through: :user_stocks
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable
end
db/migrate/[timestamp]_designe_create_users.rb:

# frozen_string_literal: true

class DeviseCreateUsers < ActiveRecord::Migration[6.0]
  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, null: false
      # 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, null: false # Only if lock strategy is :failed_attempts
      # t.string   :unlock_token # Only if unlock strategy is :email or :both
      # t.datetime :locked_at


      t.timestamps null: false
    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
  end
end

谢谢,非常感谢您的帮助

rails日志怎么说?由于字数限制,我在主帖子中添加了日志。请在操作:验证用户之前尝试注释
在应用程序控制器中,然后再次尝试登录。很难看到这里发生了什么。不管怎么说,这是一个好消息。克隆它并尝试一下是值得的。这可能会解决您的问题。@hashrocket,当我在application\u controller.rb中注释掉行时,“登录”或“注册”按钮仍然不起作用。rails日志怎么说?由于字数限制,我在主帖子中添加了日志。请在\u操作:验证用户之前尝试注释掉
在应用程序控制器中,然后再次尝试登录。很难看到这里发生了什么。不管怎么说,这是一个好消息。克隆它并尝试一下是值得的。这可能会解决您的问题。@hashrocket,当我在application_controller.rb中注释掉该行时,“登录”或“注册”按钮仍然不起作用。
class ApplicationController < ActionController::Base
  before_action :authenticate_user!
end
Rails.application.routes.draw do
  resources :user_stocks
  devise_for :users
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
  root to: 'welcome#index'
  get 'my_portfolio', to: 'users#my_portfolio'
  get 'search_stock', to: 'stocks#search'
end
# frozen_string_literal: true

class DeviseCreateUsers < ActiveRecord::Migration[6.0]
  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, null: false
      # 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, null: false # Only if lock strategy is :failed_attempts
      # t.string   :unlock_token # Only if unlock strategy is :email or :both
      # t.datetime :locked_at


      t.timestamps null: false
    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
  end
end
$ rails s
Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.
=> Booting Puma
=> Rails 6.0.3.2 application starting in development 
=> Run `rails server --help` for more startup options
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

  * development - set it to false
  * test - set it to false (unless you use a tool that preloads your test environment)
  * production - set it to true

Puma starting in single mode...
* Version 4.3.5 (ruby 2.7.0-p0), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
Use Ctrl-C to stop
Started GET "/users/sign_in" for ::1 at 2020-07-15 20:33:30 -0700
Processing by Devise::SessionsController#new as HTML
   (0.8ms)  SELECT sqlite_version(*)
  Rendering devise/sessions/new.html.erb within layouts/application
  Rendered devise/shared/_links.html.erb (Duration: 2.7ms | Allocations: 713)
  Rendered devise/sessions/new.html.erb within layouts/application (Duration: 31.9ms | Allocations: 5455)
/Users/kevinjay/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/helper.rb:355: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/kevinjay/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:118: warning: The called method `[]' is defined here
[Webpacker] Everything's up-to-date. Nothing to do
  Rendered layouts/_navigation.html.erb (Duration: 3.0ms | Allocations: 112)
  Rendered layouts/_messages.html.erb (Duration: 0.8ms | Allocations: 198)
Completed 200 OK in 154ms (Views: 125.9ms | ActiveRecord: 2.4ms | Allocations: 24815)


Started GET "/my_portfolio" for ::1 at 2020-07-15 21:35:15 -0700
Processing by UsersController#my_portfolio as HTML
Completed 401 Unauthorized in 5ms (Allocations: 388)


Started GET "/users/sign_in" for ::1 at 2020-07-15 21:35:16 -0700
Processing by Devise::SessionsController#new as HTML
  Rendering devise/sessions/new.html.erb within layouts/application
  Rendered devise/shared/_links.html.erb (Duration: 1.2ms | Allocations: 169)
  Rendered devise/sessions/new.html.erb within layouts/application (Duration: 7.7ms | Allocations: 1077)
[Webpacker] Everything's up-to-date. Nothing to do
  Rendered layouts/_navigation.html.erb (Duration: 0.1ms | Allocations: 5)
  Rendered layouts/_messages.html.erb (Duration: 0.1ms | Allocations: 29)
Completed 200 OK in 79ms (Views: 72.8ms | Allocations: 6463)