Sha256: d07acd9a2583596df7291f4b41336199269d85ab72b881e7ae643f6931b68bce

Contents?: true

Size: 902 Bytes

Versions: 3

Compression:

Stored size: 902 Bytes

Contents

require 'ruby-debug'

module BootstrapsBootstraps
  class Railtie < Rails::Railtie
    initializer "bootstraps_bootstraps.configure_rails_initialization" do |application|
      # Prevent Rails from wrapping form elements with errors in <div class="field_with_error">
      # boxes.  Bootstrap has a bit of a different paradigm.
      # Credit where due: http://stackoverflow.com/questions/5267998/rails-3-field-with-errors-wrapper-changes-the-page-appearance-how-to-avoid-t
      application.config.action_view.field_error_proc = Proc.new { |html_tag, instance| html_tag }
    end

    config.to_prepare do
      #RELOAD THE GEM ALL THE TIME WITHOUT RESTARTING THE SERVER :O (without restarting the server)
      ::ActionView::Helpers.send(:load, 'bootstraps_bootstraps/bootstrap_form_builder.rb')
      ::ActionView::Helpers.send(:include, BootstrapsBootstraps::BootstrapFormHelper)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bootstraps_bootstraps-2.0.2 lib/bootstraps_bootstraps/railtie.rb
bootstraps_bootstraps-2.0.1 lib/bootstraps_bootstraps/railtie.rb
bootstraps_bootstraps-2.0.0 lib/bootstraps_bootstraps/railtie.rb