Hi I'm having a problem creating a view widget inside my erb template.
Please see the following gist https://gist.github.com/5723324
Basically I'm trying to isolate a complex piece of html markup with
something like :
<%= Accordion.new(parent: "my-parent") do |accordion| %>
accordion.element("elem1")
accordion.element("elem2")
<% end %>
But yielding self does not return my object instance but the erb
template. It seems in rails there is a need to "capture" a given block
but I can't figure out how to do this. I'm able to do something similar
via a rails helper however I wanted to create an object to keep things
DRY. Any help much appreciated !
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/fb178e8ec4a9c4c91699ef29baa3e928%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.