# \[Markaby\] yield instead of @content\_for\_layout?

**URL:** <https://www.ruby-forum.com/t/markaby-yield-instead-of-content-for-layout/101975>\
**Category:** Rails\
**Created:** [August 9, 2006, 1:02am UTC](https://www.ruby-forum.com/t/markaby-yield-instead-of-content-for-layout/101975 "2006-08-09T01:02:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [August 9, 2006, 1:02am UTC](https://www.ruby-forum.com/t/markaby-yield-instead-of-content-for-layout/101975/1 "2006-08-09T01:02:48Z")

</div>

We’re supposed to use yield instead of @content\_for\_layout, but I can’t  
get yield to work in a Markaby template:

yield

text yield

Either one of these lines results in a ‘no block given’ error (but ‘text  
@content\_for\_layout’ works). Anybody know how to use yield instead?

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [April 3, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/markaby-yield-instead-of-content-for-layout/101975/2 "2007-04-03T16:20:04Z")

</div>

Joe R. wrote:

> We’re supposed to use yield instead of @content\_for\_layout, but I can’t  
> get yield to work in a Markaby template:
> 
> yield
> 
> text yield
> 
> Either one of these lines results in a ‘no block given’ error (but ‘text  
> @content\_for\_layout’ works). Anybody know how to use yield instead?
> 
> Thanks,  
> Joe

Use content\_for\_layout method.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [April 4, 2007, 3:57pm UTC](https://www.ruby-forum.com/t/markaby-yield-instead-of-content-for-layout/101975/3 "2007-04-04T15:57:11Z")

</div>

I use yield all the time:  
\<%= yield %\>

I’m on Rails 1.2.3 and Ruby 1.8.5 – maybe your version is the issue  
(as I recall, ‘yield’ is the newer, preferred method).

…jon

On Apr 3, 7:20 am, Ilya N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
