Re: Trying to create a "view object" with yield self

Berlimioz
2013-06-07T13:33:46Z

Hi pry_f !

Sorry but I''m not sure to have exactly understood what you''re
trying to do.
What I understand from the code you made available is that the lines below
should display something like

opening
elem1: parent is my-parent
elem2: parent is my-parent
closing

and it doesn''t ?

Le jeudi 6 juin 2013 19:48:46 UTC+2, Ruby-Forum.com User a écrit
:
>
> 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
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit