1

button_to在演示者内部使用。这工作正常。但是,如果我创建一个块,我会收到错误

undefined method `stringify_keys'

我想知道是否甚至可以在button_to视图文件之外使用块。

# Inside my presenter class

# The line below causes the error
button_to 'Big Button', '/', {} do
  link_to('Home', '/', { })
end.html_safe

我怎样才能解决这个问题?我错过了一些相当明显的东西吗?

4

1 回答 1

2

我不确定你为什么要在按钮内显示链接,但是,你可以试试这个:

button_to '/', { ... } do
  'Big Button'
  link_to('Home', '/', { ... })
end.html_safe

您不需要将标签作为第一个参数包含在您的button_to块中。

于 2016-05-10T16:11:19.920 回答