【发布时间】:2013-08-06 06:06:29
【问题描述】:
我想在 Rails 中设置一个非资源性路线,但我不知道如何。 Rails api 说结构必须是这样的。发布'post/:id' => 'posts#create_comment' 但是,我不确定我应该写什么。
我希望它发布到 bankacctscontroller 中的方法“addbank” 我将在页面 localhost:3000/bankaccts/new
def addbank
if (params['customer_uri'])
current_user.customer_uri = (params['customer_uri'])
end
if current_user.save
redirect_to root_url, :notice => "bank account added"
else
render json: {error: "Payment account could not be configured properly"}, status: 401
end
end
【问题讨论】:
标签: ruby-on-rails ruby