observe_form url 混淆
我似乎无法让observe_form调用特定操作
路线
map.resources :charges, :collection => {:charge_total => :get}
我有一个定义了我的控制器的
class ChargesController < ApplicationController
def charge_total
return 'foo'
end
end
我的观点:我已经尝试了两者...
observe_form form_id, :update => :charge_total, :url => :charge_total_charges
并且
observe_form form_id, :update => :charge_total, :url => {:controller => :charges, :action => :charge_total}
当表单更新时,我收到一个未知的操作错误,
No action responded to update. Actions: charge_total, create
它看到有一个操作charge_total,但是它正在尝试响应更新?我不确定发生了什么事。有什么想法吗?
i cannot seem to get observe_form to call a particular action
i have a route defined
map.resources :charges, :collection => {:charge_total => :get}
my controller
class ChargesController < ApplicationController
def charge_total
return 'foo'
end
end
my view: i have tried both...
observe_form form_id, :update => :charge_total, :url => :charge_total_charges
and
observe_form form_id, :update => :charge_total, :url => {:controller => :charges, :action => :charge_total}
when the form updates, i get an unknown action error
No action responded to update. Actions: charge_total, create
it sees that there is an action charge_total, however it is trying to respond to update? im not sure what is going on. any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
呸!
放置,而不是获取...
map.resources :charges, :collection => {:charge_total =>; :放}
bahh!
put, not get...
map.resources :charges, :collection => {:charge_total => :put}