开发者

Rails: Send put method from a index view

I want do be able do update some values direct form the index view of my subscription Resource.

To do so I try the following code:

subscription_path(subscription, :method => :put)

The problem is, that this goes directs to the show action as if the met开发者_运维技巧hod would be :get!

Thanks for your help! Maechi


It sounds like you're wanting to show a form for editing Subscriptions on the Subscriptions index page. Assuming that you have a @subscription variable in scope that represents an existing Subscription record you want to edit, you should be able to do:

<% form_for @subscription do |f| %>
...
<% end %>

—which will submit a PUT request to your controller's update action.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜