这不是路由问题,而是内容格式问题。你应该使用respond_to
。
class CreditPurchasesController < ActionController::Base
# This is a list of all possible formats this controller might expect
# We need php and cgi, and I'm guesses html for your other methods
respond_to :html, :php, :cgi
def create
# ...
# Do some stuff
# ...
# This is how you can decide what to render based on the format
respond_to do |format|
# This means if the format is php or cgi, then do the render
format.any(:php, :cgi) { render :something }
# Note that if you only have one format for a particular render action, you can do:
# format.php { render :something }
# The "format.any" is only for multiple formats rendering the exact same thing, like your case
end
end
end
我不认为你可以这样调用:create操作,这是由于Rails惯例(不积极,但我似乎记得几年前遇到问题)。尝试使用不同的名称创建新操作。另外,我认为.php和.cgi可能不适合路由。我将路线更改为domain/merkin_postback /:id – jschorr