0

这个问题与路由过滤器有关。

我认为这是:

<% form_for :post, :url => {:action => "show"} do |f| %>

在浏览器中翻译为:

<form action="/en/posts/show" method="post">

更改I18n.locale例如后

I18n.locale = :en

html变成:

<form action="/en/posts/72" method="post">

并且该操作不起作用,我收到此错误:

未知动作

对 72 没有任何回应。

当然,没有像 72 这样的动作。这个数字当然是表演动作的输入。这是正确的邮政编号。所以如果我把这个地址 localhost:3000/en/posts/72 放到浏览器中,那么它给我的页面没有问题。

那么为什么它在表格中不起作用呢?

谢谢。

4

1 回答 1

2

指定这样的方法:

<% form_for :goal, :url => { :action => 'show' }, :html => {:method => :put} do |f| %>

它对我有用。

于 2010-01-02T07:37:09.573 回答