2017-05-08 6 views
-2

リンクをクリックするかリダイレクトを使用すると、URLにURLが追加されます。http://plushcash-chat.backtrak.co/ URLをクリックする前と同様に、ここをクリックすると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 
+0

あなたのコントローラコード – puneet18

+0

を貼り付けて表示します。ルートはよく見える。フォームを提出したときに間違ったURLにリダイレクトされましたが、私が再びホームページにアクセスしたとき、私のセッションは継続されました。 –

+0

puneet18私はそれを編集した後私の質問に上記のコントローラーコードを貼り付けました。 –

答えて

1

は - 「」どこかにあります。

あなたのブラウザのコンソールで自分自身のためにチェックすることができたよう:

> decodeURIComponent("%2C%20") 
> ", " 

をジャストリンクが設定されているビューの正確な部分を、確認してください。

関連する問題