开发者

Why is my method in application_controller not visible?

开发者 https://www.devze.com 2023-01-29 15:14 出处:网络
In my开发者_开发问答 applicatin_controller.rb I added: def test? true end I tried using it in my view and it didn\'t work

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

精彩评论

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

关注公众号