0
# GET system_accounts/:id
  def show 
    # If a system account already exists in session, it was found from a search with the account id
    # Otherwise, this is a new search for a system account by the given id
    if params[:id]
      Rails.logger.debug { "Querying for the account with id: #{params[:id]}" }
      response = query_account(CGI.escape(params[:id]))
    if response.is_a?(Net::HTTPSuccess)
        @account = JSON.parse(response.body)
    unless @account.empty?
      redirect_to system_accounts_path(params[:id])        
    end 
    end

上記は私のショーアクションです。つまり、id = 2で検索すると、結果のリンクはsystem_accounts / 2になるはずですが、取得するのはsystem_accounts.2です。なぜ。/の代わりに。私が見逃しているものはありますか?

4

1 に答える 1

1

レールの規則に厳密に従っている場合は、system_account_path(params[:id])(を使用せずにs)を使用する必要があります。2はフォーマットとして解釈されるため、おそらくsystem_accountsコントローラーのインデックスアクションを指している.2ため、URLに追加されます。system_accounts_pathsを削除して、showアクションをポイントします。

于 2013-02-19T23:50:14.080 に答える