jason328 jason328 - 1 year ago 102
Ruby Question

button_to block in presenter

I'm using

inside the presenter. This works fine. However if I create a block I receive the error

undefined method `stringify_keys'

I'm wondering if it's even possible to use a
block outside of a view file.

# Inside my presenter class

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

How can I fix this? Am I missing something rather obvious?

Answer Source

I am not sure why you want to show a link inside of a button, but, you can try this:

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

You don't need to include a label as a first argument to your button_to block.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download