需要有create
的替代路线必须兼顾:
POST /users
POST /users/new
来自question的推荐如何添加没有ID的路线:
resource :user do
get :me, on: :member
end
不用user
而是users
:
resources :users do
post :new, on: :create
end
崩溃讯息:
NameError:未定义的局部变量或方法`on'for#< ActionDispatch :: Routing :: Mapper:0x0000081022c8c0 \>
解决方案是什么?
答案 0 :(得分:1)
尝试
Try below query :
where ( `zipCode` between "40000" and "42000" OR `zipCode` between "50000" and
"51000" OR `zipCode` between "53000" and "60000" )
AND plan = "sell" AND created_at > '2017-01-01' AND clone_id is not null
您需要指定HTTP动词,操作和目标。如果目标是resources :users do
post :new, on: :collection
end
,那么Rails需要一个" id"参数并根据该参数构造URL。
请务必阅读此guide on Rails routes。