我想在我的表单助手中放置一个路由助手来执行update
操作:
<%= s3_uploader_form post: <route helper goes here>, as: "shop[logo_ori]" do %>
<%= file_field_tag :file %>
<% end %>
但是当我跑步时,rake routes
我看不到帮助者PUT
:
shops GET /shops(.:format) shops#index
POST /shops(.:format) shops#create
new_shop GET /shops/new(.:format) shops#new
edit_shop GET /shops/:id/edit(.:format) shops#edit
shop GET /shops/:id(.:format) shops#show
PUT /shops/:id(.:format) shops#update
有问题的表单助手来自 Railscasts#383's source。我发现上传器表单对于创建新模型对象非常有用,但我很难让它用于更新模型对象。
当我尝试 route helpershops_url
时,它运行失败的POST
操作:
Started POST "/shops" for 127.0.0.1 at 2012-12-27 01:10:22 +0800
Processing by ShopsController#create as */*
Parameters: {"shop"=>{"logo_ori"=>"https://bucket.s3.amazonaws.com/example.gif"}}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
(0.1ms) BEGIN
(0.1ms) ROLLBACK
<additional output redacted>
有什么帮助吗?