-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pass object class name with a data attribute instead of parsing the input's name #52
Conversation
Well, rspec was passing :) I'll look into the JS test tomorrow. |
Thanks @jamesmk, I'm curious what the returned name on your forms input is. I did a little testing with form_for/simple_form and it seems to be returning a name spaced class name. ex.
In my tests, If Engines cause the element name to not be name spaced within FormBuilder or SimpleForm, It might make sense to have Judge keep its current |
@dannysperry thanks for the feedback. I thought it might have been an issue with how the class was rendering in the element. It was assigned in the engine (you know the one) as Even if Also, I didn't see a reason to keep |
Valid point on Namspace::Model. I agree there should be a constant klass attribute. There are two helper methods called Remove those and I can get this merged in. |
Good call, removed. |
pass object class name with a data attribute instead of parsing the input's name
+1 @jamesmk |
Thanks @dannysperry! Since this gem is a dependency in my engine, there's no way link it directly to a repo. So for me to see the effect of this fix in production, I need a new version of the gem released. It looks like there's been a lot of activity since last release, any chance of getting an ETA on a new one? cc @joecorcoran thanks again |
This fixes an issue I've run into with nested models, specifically from an engine. Passing an
Engine::User
instance through to simple_form or form_for will only create input names from the base class by default. This leave Judge trying to matchEngine::User
withUser
and returning aNullValidation
.My solution is to pass the class name directly through as a data attribute. Tests are passing and it works like a charm for nested and unested models. Let me know what you think.
thanks