Reputation: 1784
So I was trying to call link_to in a helper module
here is the code
module GroupsHelper
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper
def self.link_to_publish
link_to "test"
end
end
It returns
undefined local variable or method `link_to' for GroupsHelper:Module
Does anyone know why? Thx
Upvotes: 1
Views: 1188
Reputation: 13433
Drop the "self.". It's not a class method.
Assumption: GroupsHelper is in rails app's app/helpers/groups_helper.rb
Upvotes: 2