On Jun 17, 12:07 am, Noah Hendrix
<noahhend...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I have a site that calls for multiple content areas on a screen. In
> order to remain DRY I wanted to create a helper that helped reduce the
> markup.
>
> At a high level I have a helper method that creates an instance of a
> ContentBlock class and calls render on it. I want to render everything
> inside the block passed to the helper method in the context of
> ContentBlock, so that I can do something like
>
> content do |c|
> c.tab do
> ''tab content''
> end
>
> c.tab do
> ''other tab content''
> end
> end
>
> Right now when I do what I have posted in the gist below I get the
> following error:
>
> undefined method `safe_concat'' for nil:NilClass, I''m
assuming that is
> because it tries to buffer the template code and execute it in the
> context of my content block class.
Well you do evaluate the block by calling instance_eval on yourself,
so your asking for it to be evaluated in the context of your
ContentBlock object. You probably want all that to happen on the
template object instead.
Fred>
> Here is the gist of what I am currently
have:https://gist.github.com/1030466
> Here is a mockup of the final product:http://imgur.com/nRVqI
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.