-2
링크를 클릭하거나 리디렉션을 사용하면 항상 URL에 URL이 추가됩니다. 내 URL을 클릭하기 전에처럼 표시됩니다. http://plushcash-chat.backtrak.co/ 그러나 여기 보이는 URL을 클릭하면 :링크를 클릭하면 URL에 URL이 다시 추가됩니다. Rails
root 'chatrooms#index'
resources :chatrooms do
collection do
get :check_username
end
end
resources :messages
get '/signed_out', to: 'welcome#sign_out_user'
get "leaderboards/top_affiliates"
get '/chat', to: 'welcome#chat'
mount ActionCable.server => '/cable'
컨트롤러 코드 : http://plushcash-chat.backtrak.co%2C%20plushcash-chat.backtrak.co/
내 경로는 다음과 같다 등록 컨트롤러
build_resource(configure_sign_up_params)
resource.save
yield resource if block_given?
if resource.persisted?
if resource.active_for_authentication?
set_flash_message! :notice, :signed_up
sign_up(resource_name, resource)
respond_with resource, location: after_sign_up_path_for(resource)
else
set_flash_message! :alert, :"signed_up_but_#{resource.inactive_message}"
expire_data_after_sign_in!
respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource
end
cookies.signed[:user_id] = current_user.id
모든 컨트롤러에서 발생합니다. 나는 다음을 사용하고있다 :
if current_user.present?
@chatroom = Chatroom.new(chatroom_params)
if @chatroom.save
respond_to do |format|
format.html { redirect_to @chatroom }
format.js
end
else
respond_to do |format|
flash[:notice] = {error: ["a chatroom with this topic already exists"]}
format.html { redirect_to new_chatroom_path }
format.js { render template: 'chatrooms/chatroom_error.js.erb'}
end
end
else
redirect_to root_url
end
당신에게 컨트롤러 코드 – puneet18
을 붙여서보기, 특수 형식. 경로가 좋아 보인다. 양식을 제출했을 때 잘못된 URL로 리디렉션되었지만 다시 홈페이지를 방문하면 세션이 계속되었습니다. –
puneet18 내가 편집 한 후 내 질문에 위의 컨트롤러 코드를 붙여 넣습니다. –