if Jquery ajax cache is set to false, the cache busting params causes client_side_validations to barf #255

Closed
maxwell opened this Issue Jan 19, 2012 · 4 comments

Comments

Projects
None yet
2 participants

maxwell commented Jan 19, 2012

Hi,

If you need to have jQuery.ajaxSetup({'cache': false}) for your application (like if you are making heavy use of Backbone.js) Jquery adds a "_=328742394734" style cache busting param to every ajax request made.

When the client side validation middleware tries to validate this, it assumes it is an addr of the model, and throws an exception.

Since this is a core Jquery thing, it would be cool if client_side_validations ignored this parameter.

maxwell commented Jan 19, 2012

I'd be happy to submit a patch and tests, if you just told me the right place to take care of this as well.

Contributor

bcardarella commented Jan 20, 2012

You probably want to remove it from the request all together on this line: https://github.com/bcardarella/client_side_validations/blob/3-1-stable/lib/client_side_validations/middleware.rb#L29

This will ensure that any other remote validator plugins will benefit from this as well.

If you make a pull request, please do so to the 3-1-stable branch as that is the branch I am releasing from until I complete the 4.0 rewrite.

maxwell commented Jan 21, 2012

Thanks for the quick response. I will try to give it a shot this weekend! Thanks!

Contributor

bcardarella commented Jan 23, 2012

Is '_' the common cache buster param? I want to make sure this is covered for all cases. Or perhaps making this a config option somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment