26
26

More than 5 years have passed since last update.

deviseのViewを編集しても反映されない

Last updated at Posted at 2014-07-11

追記

@k-shogo さんにコメントを頂きました.
コメント欄の方法が正しい解決方法だと思うので,以下は参考程度にどうぞ!

症状

rails g devise:views

をしたviewを編集しても、反映されない。

解法

config/routes.rbを以下のように変更し、

Rails.application.routes.draw do
  devise_for :users, controllers: {
    registrations: 'users/registrations',
    sessions: "users/sessions",
  }
end

を追加し、
app/controllers/users/registrations.rb

class Users::RegistrationsController < Devise::RegistrationsController
  # GET /resource/sign_up
  def new
    super
  end

  def create
    super
  end
end

app/controllers/users/sessions.rb

class Admins::SessionsController < Devise::SessionsController
  # GET /resource/sign_in
  def new
    super
  end

  # POST /resource/sign_in
  def create
    super
  end

  # DELETE /resource/sign_out
  def destroy
    super
  end
end

とする。

特にroutesの設定がない場合( devise_for :users しか書いていない場合)、デフォルトのViewを見に行っているような気がする。

26
26
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
26