How can i add rails route helpers like "root_path" to a class like my_model.rb as a class method?
So my class is like this:
Class MyModel
def self.foo
return self.root_path
end
end
MyModel.foo
The above doesn't work because Class MyModel doesn't respond to root_path
This is what I know:
- I can use include
Rails.application.routes.url_helpers
, but that only add the module's methods as instance methods - I tried doing extend
Rails.application.routes.url_helpers
but it didn't work
Please feel free to school me :)