2013-06-02 2 views
0

나에게 도움이 될만한 사람이 있기를 바랍니다. 나는 (플레이어에 따라 체크되거나 체크되지 않는) 체크 박스를 출력하는 도우미 메서드를 만들었습니다. 플레이어의 그림과 플레이어의 이름. 불행히도 출력되는 것은 체크 박스뿐입니다. 나는 방금 빈 리튬을 얻고있다.ROR 중첩 content_tag

def add_players_and_checkboxes(game_id,user) 

    boolean = 0 

    find_all_players(game_id).each do |p| 
    boolean = true if user.id == p.id 
end 

output = content_tag :div, :class => "span2" do 
    concat(content_tag :li, add_check_box(user,game_id,boolean)) 
    concat(content_tag :li) do 
    concat(content_tag :ul) do 
     concat(content_tag :li) do 
     concat(image_tag(user.picture, :height => '50px',:alt => 'user_pic'), :class   =>"picture") 
     end 
     concat(content_tag :li, user.first_name, :class => "name") 
    end 
    end 
end 

return output 

답변

2
output = content_tag :div, :class => "span2" do 
    content_tag(:li, add_check_box(user,game_id,boolean)) + 
    content_tag(:li) do 
    content_tag(:ul) do 
     content_tag(:li) do 
     image_tag user.picture, :height => '50px', :alt => 'user_pic', :class => "picture" 
     end + 
     content_tag(:li, user.first_name, :class => "name") 
    end 
    end 
end 
+0

문제 content_tag와 사이의 공간이었다 (: 리튬) 여기서 코드이다. 제거하면 모든 것이 작동합니다. –