This solution worked for me.
Add this code to the end of the file config/routes.rb. Be sure to replace MyAppwith your application name.
MyApp::Application.routes.named_routes.module.module_eval do
def model_name_path(*args)
end
def model_name_url(*args)
end
end
MyApp::Application.routes.named_routes.instance_eval do
@helpers += [:model_name_path, :model_name_url]
end
These custom methods will be available in controllers, views, and tests.
source
share