## routes.rb
devise_for :users
root to: "home#index"
match '/amount', to: 'amount#index', via: 'get'
match '/amount', to: 'amount#process', via: 'post'
## amount_controller.rb
def index
@user=current_user
end
def process
case params[:type]
when "recharge"
@user=current_user
user.recharge(@user,params[:num])
when "transfer"
@user=current_user
user.recharge(@user,params[:num],params[:to])
end
##这个时候请求'0000:3000/amount'会直接跑到process,然后蹦出一个这个错误
ArgumentError in AmountController#index
wrong number of arguments (1 for 0)
##然后改成 process(arg) 将arg 打出来是"index"
为什么?
谢谢。