Update Formtastic and formtastic-bootstrap

Previous version of Formtastic was giving following deprecation warning:
`#column_for_attribute` will return a null object for non-existent
columns in Rails 5. Use #has_attribute? if you need to check for
an attribute's existence.

Guide followed for upgrade: https://github.com/justinfrench/formtastic/wiki/Upgrading-to-Formtastic-3.1

formtastic-bootstrap is upgraded for compatibility with current Formtastic.
This commit is contained in:
Aditya Prakash 2016-02-12 23:38:43 +05:30
parent 5f035a7b38
commit 6460456202
3 changed files with 43 additions and 9 deletions

View file

@ -52,7 +52,7 @@ gem 'uglifier', '>= 1.3.0'
gem 'bootstrap-sass', '~> 3.3.4.1'
gem 'autoprefixer-rails'
gem 'formtastic-bootstrap'
gem 'formtastic', '~> 2.3.0.rc3'
gem 'formtastic', '~> 3.1.1'
gem 'cocoon'
# frontend javascripts

View file

@ -166,10 +166,10 @@ GEM
font-awesome-rails (4.1.0.0)
railties (>= 3.2, < 5.0)
formatador (0.2.4)
formtastic (2.3.0.rc3)
actionpack (>= 3.0)
formtastic-bootstrap (3.0.0)
formtastic (>= 2.2)
formtastic (3.1.3)
actionpack (>= 3.2.13)
formtastic-bootstrap (3.1.1)
formtastic (>= 3.0)
geocoder (1.2.2)
globalid (0.3.6)
activesupport (>= 4.1.0)
@ -504,7 +504,7 @@ DEPENDENCIES
devise_ichain_authenticatable
factory_girl_rails
font-awesome-rails
formtastic (~> 2.3.0.rc3)
formtastic (~> 3.1.1)
formtastic-bootstrap
gravtastic
guard-rspec (~> 4.2.8)

View file

@ -66,14 +66,48 @@ Formtastic::FormBuilder.required_string = proc { Formtastic::Util.html_safe(%{&n
# specifying that class here. Defaults to Formtastic::FormBuilder.
# Formtastic::Helpers::FormHelper.builder = MyCustomBuilder
# All formtastic forms have a class that indicates that they are just that. You
# can change it to any class you want.
# Formtastic::Helpers::FormHelper.default_form_class = 'formtastic'
# Formtastic will infer a class name from the model, array, string ot symbol you pass to the
# form builder. You can customize the way that class is presented by overriding
# this proc.
# Formtastic::Helpers::FormHelper.default_form_model_class_proc = proc { |model_class_name| model_class_name }
# Allows to set a custom field_error_proc wrapper. By default this wrapper
# is disabled since `formtastic` already adds an error class to the LI tag
# containing the input.
# Formtastic::Helpers::FormHelper.formtastic_field_error_proc = proc { |html_tag, instance_tag| html_tag }
# You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>`
# and `<textarea>` tags by setting this to false (defaults to true).
# Formtastic::FormBuilder.use_required_attribute = true
# and `<textarea>` tags by setting this to true (defaults to false).
# Formtastic::FormBuilder.use_required_attribute = false
# You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
# this to false. Doing so will add a `novalidate` attribute to the `<form>` tag.
# this to true. Doing so will add a `novalidate` attribute to the `<form>` tag.
# See http://diveintohtml5.org/forms.html#validation for more info.
Formtastic::FormBuilder.perform_browser_validations = true
#
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
FormtasticBootstrap::FormBuilder.default_inline_hint_class = FormtasticBootstrap::FormBuilder.default_block_hint_class
# By creating custom input class finder, you can change how input classes are looked up.
# For example you can make it to search for TextInputFilter instead of TextInput.
# See # TODO: add link # for more information
# NOTE: this behavior will be default from Formtastic 4.0
Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
# Define custom namespaces in which to look up your Input classes. Default is
# to look up in the global scope and in Formtastic::Inputs.
# Formtastic::FormBuilder.input_namespaces = [ ::Object, ::MyInputsModule, ::Formtastic::Inputs ]
# By creating custom action class finder, you can change how action classes are looked up.
# For example you can make it to search for MyButtonAction instead of ButtonAction.
# See # TODO: add link # for more information
# NOTE: this behavior will be default from Formtastic 4.0
Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
# Define custom namespaces in which to look up your Action classes. Default is
# to look up in the global scope and in Formtastic::Actions.
# Formtastic::FormBuilder.action_namespaces = [ ::Object, ::MyActionsModule, ::Formtastic::Actions ]