1

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

JayX
  • 1,754
  • 1
  • 18
  • 27

1 Answers1

2

Drop the "self.". It's not a class method.

Assumption: GroupsHelper is in rails app's app/helpers/groups_helper.rb

Aditya Sanghi
  • 13,370
  • 2
  • 44
  • 50