Alright - fuller disclosure - this is an AJAX call where I’m setting a
query string as well.
It’s a simple ZIP code lookup action. I’m setting the params that I
know about up front as part of the URL and using the route to get those.
However, for the ZIP code, which comes from the form, I’m setting that
on the query string.
Given the route above, and this call (the object_name variable has a
value of ‘insured’, the check_state variable has a value of ‘0’)
<%= text_field(object_name.to_sym,
“#{attr_prefix}zip_code”.to_sym,
:size => 10,
:maxlength => 10,
:onblur => remote_function(:url => {:action =>
‘lookup_city_and_state’,
:object_name => object_name,
:mailing => mailing ? ‘1’ :
‘0’,
:check_state => check_state},
:with => “‘zip=’ + encodeURIComponent(this.value)”,
:before => ‘ajax_running = true; ajax_issues =
false’,
:complete => ‘ajax_running = false;’)) %>
Seems like in this case - where mailing is ‘1’, check_state is ‘0’, that
the URL comes out as expected, but params[:object_name],
params[:mailing], params[:check_state] all come in as nil.
My guess is that the presence of the query string parameter screws
things up if the URL isn’t completely specified (which seems to happen
based on the defaulting rule).
Weird. It’s not like the parameters in the URL and the parameters
spec’d in the AJAX call can’t coexist (they can if I don’t use
defaults on the route).
Well, I’m back to not defaulting for this guy.
Thanks,
Wes