Inside a controller I've tried to run this code for when users that are already logged in stumble across the sign up page
def index
if current_user
redirect_to homebase_url #should provide url to home for logged in users
end
end
I've done what the rails error message said and have added: include Rails.application.routes.url_helpers
to the containing controller class. Still getting this error though. Definitely do not want to hardcode URLs into there for legacy purposes. Thanks
Remove the include Rails.application.routes.url_helpers
declaration, it's not needed unless it's in something like a helper. Routes are included in controllers by default. Including it in a model or controller/initializer (routes are loaded before initializers) is against MVC architecture and might cause unwanted behaviour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With