ボールが来てからスペースに入るんじゃない、ボールが来る前にスペースに飛び込め
引き続きサイドバーとナビバーをいじいじ。
(参考)www.imd-net.com
アクティブ表示のための場合分けで、
アクティブ用のクラス追記するhelperが全然反応しない!なんでだ!
と思ったらスペース打ってなかった。
# 選択中のサイドメニューのクラスを返す def sidebar_activate(sidebar_link_url) current_url = request.headers['PATH_INFO'] if current_url.match(sidebar_link_url) ' class="active"' else '' end end
ここの' class="active"'の、classの前のスペースね。
これを打たないと
# サイドメニューの項目を出力する def sidebar_list_items items = [ {:text => 'User1', :path => hoge_path(xx)}, {:text => 'User2', :path => hoge_path(xx)}, {:text => 'User3', :path => hoge_path(xx)} ] html = '' items.each do |item| text = item[:text] path = item[:path] html = html + %Q(<li#{sidebar_activate(path)}><a href="#{path}">#{text}</a></li>) end raw(html) end
の、
<liclass="active">
みたいなことになってしまう。
結果それ以降のテーブルタグがバグってちゃんと反映されない、と。
<li #{sidebar_activate(path)}>
とliタグ側にスペース入れることも考えたけど、それだとactiveじゃない時に
<li >
となってちょいダサなので、sidebar_activateメソッドの場合分けにいれるべき。
初歩的なミスしかしてない。