Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

No more validation_reflection? #646

Closed
DaveSanders opened this Issue · 3 comments

2 participants

@DaveSanders

I noticed you removed validation_reflection from the docs. I recently upgraded an app to 3.1 which involved basically moving over everything piecemeal and setting formtastic back up. But, it doesn't seem like anything is looking at my database to figure out required fields. All sorts of nullable fields are showing up required.

I'm going to put in hints for now, but was just wondering if maybe I have a setup issue or something. Running 3.1rc5 if that helps.

@justinfrench
Owner

validation_reflection was providing hooks for reflecting on the validations in ActiveRecord/ActiveModel. Since the functionality we needed is now available in Rails 3 out of the box, the dependency and code that relies on validation_reflection was removed as part of the Formtastic 2 work. The README was recently updated too.

Formtastic 2 still looks at the validations provided by your models to determine what's required or not. There's one open bug for the forthcoming rc4 where :on => :create is not taken into consideration, but it would be good to know what version of Formtastic you're running (assuming 2.0.0.rc3 or bundling from master), and a specific example which you're surprised by.

@DaveSanders

I'm using rc3.

For my example, I simply had a model where a field was marked as null in mysql, but didn't have any specific validation information about the field in my model. In the old formtastic, with the reflection plugin, it would note that the field allowed null and not automatically mark the field as required on the client. Now it seems that its ignoring the database field settings entirely and just marking all fields as required on the front-end.

So, should I expect rc4 to go back to the way it was before, or do I need to give hints on the model somehow to make those fields automagically not required?

Also, as I'm typing this, I just saw the config for not marking all fields required by default, which was still commented out to the default of "true". So, we're changing that now and maybe that will make all my issues go away. :)

Forgive my boneheadedness. :)

@DaveSanders

sigh, yeah, that worked. Just flag this one as a Keyboard <> Chair interface issue...

@DaveSanders DaveSanders closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.