开发者

Why is my method in application_controller not visible?

In my开发者_开发问答 applicatin_controller.rb I added:

def test?
   true
end

I tried using it in my view and it didn't work

<%= test? %>

error:

undefined method


Controller methods are not accessible in the view by default. Try the following:

def test?
  true
end
helper_method :test?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜