Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

validates_with causes TypeError #23

Closed
scottwater opened this Issue Mar 30, 2011 · 8 comments

Comments

Projects
None yet
2 participants

On my model, I have a custom validates_with validator.

With this in place, I get a TypeError with the message, "nil is not a symbol". If I remove the validator from the model, it appears to work fine.

Thanks,
Scott

Contributor

bcardarella commented Mar 30, 2011

Hey Scott,

Could you gist some code demonstrating the failure? Also, have you seen the wiki on custom validators:

https://github.com/bcardarella/client_side_validations/wiki/Custom-Validators

This guide demonstrates how to get custom validators working.

Contributor

bcardarella commented Mar 31, 2011

Scott, any update on this issue?

Sorry for the crappy bug report. I am going to try to isolate the issue in another project and I will report back once I have that ready.

Thanks,
Scott

Here is a sample project which demonstrates the issue:

https://github.com/scottwater/validates_with_client_side_validations

Quick Summary:

In the user model, I included a custom validates_with class. This example is kind of pointless, but it does demo the issue I am seeing.

I have not tried to write my own client side validator. However, I am assuming that the form should still render without one (please let me know if this is incorrect).

Thanks again for taking a look at this. Please let me know if I can provide any other info.

Contributor

bcardarella commented Mar 31, 2011

Okay, so there are several problems here:

1.) validate_with is not something that Client Side Validations supports. validate_with works on the model as a whole. Client Side Validations works with specific attributes via validate_each.

2.) Despite this it should be ignoring this validation and allowing the logic to fallback to the server.

I understand that this is just an example but if your validations are close to this example why not just put presence validators on the first and last name fields?

Thanks for looking into it.

I am using validates_with to group my optional creditcard validations. I might refactor it out, but for now it works pretty well.

Thanks!

Contributor

bcardarella commented Mar 31, 2011

I'll push a fix maybe in a day or two to resolve the exception in this case.
Thanks for the bug report! :)

On Thu, Mar 31, 2011 at 1:34 PM, scottwater <
reply@reply.github.com>wrote:

Thanks for looking into it.

I am using validates_with to group my optional creditcard validations. I
might refactor it out, but for now it works pretty well.

Thanks!

Reply to this email directly or view it on GitHub:

bcardarella#23 (comment)

Contributor

bcardarella commented Apr 5, 2011

Fixed in 89b429b

@bcardarella bcardarella closed this Apr 5, 2011

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