[Rails] Re: Trying to create a "view object" with yield self
Berlimioz wrote in post #1111694:
> On the other hand, when you have this :
>
> <<-EOF
> <div class="accordion" id="#{@parent_id}"> <!-- first line -->
> #{yield self}
> </div> <!-- last line -->
> EOF
>
> the expression "yield self" will here return the return value of the
> block
> you pass. When you pass a block like this :
Yes that's what I was trying to do. I found my mystake. I need to use an
instance variable to build the output buffer. Here is a working ruby
"prototype" https://gist.github.com/PryFlack/5732422
Now I'm gonna have to bring this into my rails app and see how it goes
because as I said yield self behaves differently inside an ERB template.
Enjoy your week-end too !
--
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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7847532dd22d7f6dbd9b20d0186ab9c3%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home