I was defining an instance variable @url in the controller. Also, I was using a simple form_for tag in the view.
class SomeController < ApplicationController
@url = URL_STRING
- form_for :some_object, :url => @url do |f|
- #some form fields
= submit_tag 'submit'
Everything seemed normal. But, I started getting this weird error. After a bit of search, I came to know that link_to, url_for and similar method uses ActionController::Base @url instance variable to generate URLs. So, make sure that you don't use/define @url anywhere in your controllers/helpers.