2014-07-06 5 views
0

I가 상단 즉, 여러 content_for 필요 다양한 페이지 내 레이아웃에 사용되는레일 4 함께 2 콘텐츠를 병합 하시겠습니까?

- content_for :title, AppConfig.product['slogan'] 
- content_for :class, 'brand' 

:

== render 'layouts/top_wrapper' 

    main[class="view-#{yield(:class)}-wrapper"] 
    section[class="content-outer-wrapper"] 
     div[class="row"] 
     div[class="large-12"] 
      div[class="content-inner-wrapper"] 
      div[class="row"] 
       div[class="large-12 large-centered columns text-center section-title"] 
       h1 
        == yield(:title) 
      div[class="row"] 
       div[class="large-12 large-centered columns"] 
       == yield 

== render 'layouts/bottom_wrapper' 

에 함께 병합 할 수있는 방법이 있는지 궁금 해서요 단일 content_for?

답변

0

content_for은 입력 내용을 암호화하므로 입력 할 수 없습니다. 그것을 통한 배열. 그래도 데이터를 직렬화 할 수 있습니다.

- content_for :title_and_class, [AppConfig.product['slogan'], 'brand'].join(';') 
- slogan, style = yield(:title_and_class).split(';') 

약간 이상합니다.

+0

그게 내가 생각한거야. 철저한 답장을 보내 주셔서 감사합니다. 좋은 주말 보내십시오. –