0
내가 페이지를 얻으려고 노력하고는이은 "/ new_user_path"
말하는 오류가 발생합니다, 나는 그것을 클릭button_to
그러나 매번를 사용하여 디렉토리users/new
로 이동합니다 [GET]라우팅 오류
어떤 경로 일치 [얻을] "/ new_user_path"여기
는 button_to
이 난을 이야기하고 포함하는 내 application.html.haml
입니다 여기
%html
%head
%title Rotten Potatoes!
= stylesheet_link_tag 'application'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
%h1.title Rotten Potatoes!
= button_to 'Sign Up/Login', 'new_user_path', :method => :get
#main
- if flash[:notice]
#notice.message= flash[:notice]
- elsif flash[:warning]
#warning.message= flash[:warning]
= yield
시합
그 (조건문 포함)redirect_to new_user_path
가 완벽하게 정상적으로 작동하는지
class UsersController < ApplicationController
def new
end
def create
@user=User.create_user!(params[:user])
if !!(@user)
flash[:notice] = "New user #{@user.user_id} was successfully created."
redirect_to movies_path
else
flash[:notice] = "The User Id #{params[:user][:user_id]} already exists"
redirect_to new_user_path
end
end
end
참고 도움이된다면이 내 users_controller.rb
파일 내 rake routes
movies GET /movies(.:format) movies#index
POST /movies(.:format) movies#create
new_movie GET /movies/new(.:format) movies#new
edit_movie GET /movies/:id/edit(.:format) movies#edit
movie GET /movies/:id(.:format) movies#show
PUT /movies/:id(.:format) movies#update
DELETE /movies/:id(.:format) movies#destroy
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
의 결과입니다 .
문제가있는 곳을 말해 줄 수 있습니까? 또한 link_to
을 사용해 보았지만 여전히 실패합니다.