今railsチュートリアルの7.3.4をやっているのですが、
謎のエラーが出ます。
書いてない文を直せというんです。
こちらがエラーです
UserControllerTest#test_should_get_new: ActionView::Template::Error: undefined method `users_path' for #<#<Class:0x00007fad91dacb18>:0x00007fad91d776e8> Did you mean? user_path app/views/user/new.html.erb:7:in `_app_views_user_new_html_erb___911567891611576581_70191726555820' test/controllers/user_controller_test.rb:5:in `block in <class:UserControllerTest>'
users_pathってとこをuser_pathにしろと言ってきているわけですが、肝心のコードがこちらです
require 'test_helper' class UserControllerTest < ActionDispatch::IntegrationTest test "should get new" do get signup_path assert_response :success end end
users_pathなんてどこにも書いてないんです。
直し方をご教授願います。
routesとnew.html.erbも載せておきます。
Prefix Verb URI Pattern Controller#Action user_new GET /user/new(.:format) user#new root GET / satic_pages#home help GET /help(.:format) satic_pages#help about GET /about(.:format) satic_pages#about contact GET /contact(.:format) satic_pages#contact signup GET /signup(.:format) user#new user_index GET /user(.:format) user#index POST /user(.:format) user#create new_user GET /user/new(.:format) user#new edit_user GET /user/:id/edit(.:format) user#edit user GET /user/:id(.:format) user#show PATCH /user/:id(.:format) user#update PUT /user/:id(.:format) user#update DELETE /user/:id(.:format) user#destroy
<% provide(:title,'Sign up') %> <h1>新規登録</h1> <p>新しくアカウントつくるとこやで。</p> <div class="row"> <div class="col-md-6 col-md-offset-3"> <%= form_for(@user) do |f| %> <%= render 'shared/error_messages' %> <%= f.label :name %> <%= f.text_field :name, class: 'form-control' %> <%= f.label :email %> <%= f.email_field :email, class: 'form-control' %> <%= f.label :password %> <%= f.password_field :password, class: 'form-control' %> <%= f.label :password_confirmation, "Confirmation" %> <%= f.password_field :password_confirmation, class: 'form-control' %> <%= f.submit "Create my account", class: "btn btn-primary" %> <% end %> </div> </div>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/18 11:35
2018/07/18 11:43
2018/07/18 12:00 編集