TemplateError: wrong number of arguments in default_url_options()

During an app upgrade to Rails 2.2.2, I came across this error that baffled me for a few minutes:
ActionView::TemplateError
            (wrong number of arguments (0 for 1)) on line #34
            of app/views/account/_dashboard_header.rhtml:
        <br><br>
        34: &lt;%= link_to 'My Dashboard', my_dashboard_url &gt;


Checking out the backtrace:
(eval):3:in `default_url_options'
        (eval):3:in `my_dashboard_url'
        app/views/account/_dashboard_header.rhtml:34


Confusing. Why would this named route suddenly stop working? I did a search for default_url_options and found that I had overridden that function:
if production_mode?
          def default_url_options()
            { :protocol =&gt; 'https://' }
          end
        end
Aha! Back in the day, default_url_options didn't have any default options, so I wasn't bothering to merge my desired options with the options parameter. I fixed it with a reverse_merge so any passed-in options would still exist.

Established 2005 · Databasically © 2016