Rails简单导航gem如何链接除非?

时间:2012-03-12 14:21:43

标签: ruby-on-rails ruby ruby-on-rails-3

在我的导航配置文件中,我有:

sub_nav.item t.id, t.h1.force_encoding("UTF-8"), tag_path(d.slug, t.slug, params.except(:controller, :action).merge(:tag_id => t.id, :page => nil, :kat_id => nil))

我不希望它成为链接if params[:tag_id] = t.id

1 个答案:

答案 0 :(得分:0)

if params[:tag_id] == t.id
  sub_nav.item t.id, t.h1.force_encoding("UTF-8"), tag_path(d.slug, t.slug, params.except(:controller, :action).merge(:tag_id => t.id, :page => nil, :kat_id => nil))
else
  sub_nav.item t.id, t.h1.force_encoding("UTF-8")
end