質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 3.2.0

Ruby on Railsは、Rubyにより構築されたオープンソースのWebアプリケーションフレームワークである。 version 3.2.0は2012年1月2日にリリースされた。

Q&A

解決済

1回答

3666閲覧

localhost:3000が表示されません(Routing Error)

Tomoaki_Fukuda

総合スコア75

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 3.2.0

Ruby on Railsは、Rubyにより構築されたオープンソースのWebアプリケーションフレームワークである。 version 3.2.0は2012年1月2日にリリースされた。

0グッド

0クリップ

投稿2016/02/11 17:10

###前提・実現したいこと
Ruby on railsでdeviseを利用し、ユーザー登録・ログイン機能を作成しております。
ユーザー登録・ログインにおいて、「メールアドレス」ではなく、「Username」を用いたいと考えており、「メールアドレス」から「Username」に変更する作業を下記のサイト(補足情報に記載)をガイドに行いました。しかし、上手くいかず下記のエラーメッセージが表示されてしまいます。
対処方法をご恭二頂きたくお願い致します。

###発生している問題・エラーメッセージ
Routing Error
uninitialized constant Divise

Rails.root: /Users/TOMOAKI/joinup-develop

Application Trace | Framework Trace | Full Trace
Routes

Routes match in priority from top to bottom

Helper HTTP Verb Path Controller#Action
Path / Url
Path Match
new_user_session_path GET /users/login(.:format) devise/sessions#new
user_session_path POST /users/login(.:format) devise/sessions#create
destroy_user_session_path DELETE /users/logout(.:format) devise/sessions#destroy
user_password_path POST /users/password(.:format) devise/passwords#create
new_user_password_path GET /users/password/new(.:format) devise/passwords#new
edit_user_password_path GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration_path GET /users/cancel(.:format) devise/registrations#cancel
user_registration_path POST /users(.:format) devise/registrations#create
new_user_registration_path GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration_path GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
joinup_index_path GET /joinup/index(.:format) joinup#index
joinup_show_path GET /joinup/show(.:format) joinup#show
projects_path GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project_path GET /projects/new(.:format) projects#new
edit_project_path GET /projects/:id/edit(.:format) projects#edit
project_path GET /projects/:id(.:format) projects#show
PATCH /projects/:id(.:format) projects#update
PUT /projects/:id(.:format) projects#update
DELETE /projects/:id(.:format) projects#destroy
members_path GET /members(.:format) members#index
POST /members(.:format) members#create
new_member_path GET /members/new(.:format) members#new
edit_member_path GET /members/:id/edit(.:format) members#edit
member_path GET /members/:id(.:format) members#show
PATCH /members/:id(.:format) members#update
PUT /members/:id(.:format) members#update
DELETE /members/:id(.:format) members#destroy
users_path GET /users(.:format) users#index
POST /users(.:format) users#create
new_user_path GET /users/new(.:format) users#new
edit_user_path GET /users/:id/edit(.:format) users#edit
user_path GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
root_path GET / divise/sessions#new
Request

Parameters:

None
Toggle session dump
Toggle env dump
Response

Headers:

None
x

###コード:config>locales>routes.rb

ruby

1Rails.application.routes.draw do 2 #devise_for :users 3 #0212追記 4 devise_for :users, path_names:{sign_in: "login", sign_out: "logout"} 5 6 7 get 'joinup/index' 8 get 'joinup/show' 9 10 #get 'joinup/index' 11 #root to:'joinup#index' 12 13 resources :projects 14 resources :members 15 resources :users 16 17 #0212追記 18 #ログイン画面をホームにする 19 devise_scope :user do 20 root :to => "divise/sessions#new" 21 end 22 23 24 25 26 # The priority is based upon order of creation: first created -> highest priority. 27 # See how all your routes lay out with "rake routes". 28 29 # You can have the root of your site routed with "root" 30 # root 'welcome#index' 31 32 # Example of regular route: 33 # get 'products/:id' => 'catalog#view' 34 35 # Example of named route that can be invoked with purchase_url(id: product.id) 36 # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 37 38 # Example resource route (maps HTTP verbs to controller actions automatically): 39 # resources :products 40 41 # Example resource route with options: 42 # resources :products do 43 # member do 44 # get 'short' 45 # post 'toggle' 46 # end 47 # 48 # collection do 49 # get 'sold' 50 # end 51 # end 52 53 # Example resource route with sub-resources: 54 # resources :products do 55 # resources :comments, :sales 56 # resource :seller 57 # end 58 59 # Example resource route with more complex sub-resources: 60 # resources :products do 61 # resources :comments 62 # resources :sales do 63 # get 'recent', on: :collection 64 # end 65 # end 66 67 # Example resource route with concerns: 68 # concern :toggleable do 69 # post 'toggle' 70 # end 71 # resources :posts, concerns: :toggleable 72 # resources :photos, concerns: :toggleable 73 74 # Example resource route within a namespace: 75 # namespace :admin do 76 # # Directs /admin/products/* to Admin::ProductsController 77 # # (app/controllers/admin/products_controller.rb) 78 # resources :products 79 # end 80end 81

###コード:views>sessions>new.html.erb

ruby

1<h2>ログイン</h2> 2 3<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 4 <!-- 5 <div class="field"> 6 <%= f.label :email %><br /> 7 <%= f.email_field :email, autofocus: true %> 8 </div> 9 --> 10 11 <div class="field"> 12 <%= f.label :username %><br /> 13 <%= f.email_field :username, autofocus: true %> 14 </div> 15 16 17 <div class="field"> 18 <%= f.label :password %><br /> 19 <%= f.password_field :password, autocomplete: "off" %> 20 </div> 21 22 <% if devise_mapping.rememberable? -%> 23 <div class="field"> 24 <%= f.check_box :remember_me %> 25 <%= f.label :remember_me %> 26 </div> 27 <% end -%> 28 29 <div class="actions"> 30 <%= f.submit "Log in" %> 31 </div> 32<% end %> 33 34<%= render "devise/shared/links" %> 35

###補足情報(言語/FW/ツール等のバージョンなど)
下記のサイトを参照しました。
http://ruby-rails.hatenadiary.com/entry/20140804/1407168000

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

ルート指定でのスペルミスです。

ruby

1# 誤 2root :to => "divise/sessions#new" 3# 正 4root :to => "devise/sessions#new"

投稿2016/02/12 01:12

maisumakun

総合スコア145184

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Tomoaki_Fukuda

2016/02/12 03:41

ありがとうございます! 無事に解決しました^^
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問