GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
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
If I derive a new builder from SemanticFormBuilder, I can set Formtastic::SemanticFormHelper::builder to make my new class the deafult used by SematincFormHelper::sematic_form_for, SemanticFormHelper::semantic_fields_for, etc. However SemanticFormBuilder::semantic_fields_for hardcodes :builder as Formtastic::SemanticFormBuilder, and adds it to the options with merge, which prevents overriding it when called. It would be better if the class used for :builder was settable, or reverse_merge was used so that if it is passed in the options it gets used as specified
This is absolutely something that should be supported. You should be able to set Formtastic::SemanticFormHelper.builder = YourCustomBuilder in your initializer. I think there may be a few gaps in the implementation around semantic_fields_for and nested models (which I'll create a new issue for), but give it a try and let me know what we're missing.
Closing this issue for now, please feel free to re-open.
Yes - it is exactly the issue with nested models that I'm hitting currently - also using reverse_merge instead of merge when bringing in the default builder parameter (in SemanticFormBuilder::semantic_fields_for) would allow the user to pass in a :builder option and have it used
I've fixed this on my local fork, but I'm tethering on an iPhone and can't seem to push right now.... So I'll push this up soon and get you to verify before cutting a new gem.
Ok, that's better. See http://github.com/justinfrench/formtastic/commit/51bbaf925756322636267a505f91509b123665dd. I you can install the plugin on edge and verify, I'll cut a new gem. Closing this issue for now.
Doesnt seem to have fully fixed the issue I'm having because of the hardcoded opts.merge!(:builder => Formtastic::SemanticFormBuilder)
Gah, I fixed that! Not sure what happened in my commit, have pushed up a subsequent commit sorry 1182961.
included in 0.2.3 gem