Heroku を使用してデプロイした Rails アプリがあります。アプリをローカルで実行すると、フォームを送信した後に正常にリダイレクトできます。ただし、Heroku ではリダイレクトを行っていないようです。
Heroku からのログは次のとおりです。
2013-05-23T03:07:34.010275+00:00 app[web.1]: Started PUT "/projects/1/steps/0" for 76.118.180.235 at 2013-05-23 03:07:34 +0000
2013-05-23T03:07:34.940208+00:00 app[web.1]: Started GET "/projects/1/steps/update_ancestry?stepID=3&stepAncestry=1%2F2&position=2" for 76.118.180.235 at 2013-05-23 03:07:34 +0000
2013-05-23T03:07:34.975195+00:00 app[web.1]: Started GET "/projects/1/steps/update_ancestry?stepID=1&stepAncestry=0&position=0" for 76.118.180.235 at 2013-05-23 03:07:34 +0000
2013-05-23T03:07:34.999327+00:00 app[web.1]: Started GET "/projects/1/steps/update_ancestry?stepID=2&stepAncestry=1&position=1" for 76.118.180.235 at 2013-05-23 03:07:34 +0000
ローカル サーバーでの実行からのログ (不要なデバッグ メッセージを削除):
Started PUT "/projects/86/steps/0" for 127.0.0.1 at 2013-05-22 23:08:57 -0400
Redirected to http://0.0.0.0:3000/projects/86/steps
Completed 302 Found in 26ms (ActiveRecord: 6.9ms)
Started GET "/projects/86/steps" for 127.0.0.1 at 2013-05-22 23:08:57 -0400
Started GET "/projects/86/steps/update_ancestry?stepID=463&stepAncestry=0&position=0" for 127.0.0.1 at 2013-05-22 23:08:57 -0400
Started GET "/projects/86/steps/update_ancestry?stepID=471&stepAncestry=463&position=1" for 127.0.0.1 at 2013-05-22 23:08:57 -0400
Heroku のログを見ると、リダイレクトが行われていないことがわかります。
ここで何がうまくいかないのでしょうか?Heroku からエラー メッセージが表示されているようには見えません...
steps_controller.rb:
class StepsController < ApplicationController
before_filter :get_global_variables
def update
@step = @project.steps.find_by_position(params[:id])
@step.images.each do |image|
image.update_attributes(:saved => true)
end
respond_to do |format|
if @step.update_attributes(params[:step])
format.html { redirect_to project_steps_path(@project), :notice => 'Step was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
format.json { render :json => @step.errors, :status => :unprocessable_entity }
end
end
end
private
def get_global_variables
@project = Project.find(params[:project_id])
@steps = @project.steps.order("position")
@numSteps = @steps.count
@ancestry = @steps.pluck(:ancestry) # array of ancestry ids for all steps
@allBranches # variable for storing the tree structure of the process map
@user = @project.user # user who created the project
end
end