lib/generators/admin/install/install_generator.rb in administration-zero-0.0.15 vs lib/generators/admin/install/install_generator.rb in administration-zero-0.0.16
- old
+ new
@@ -5,9 +5,20 @@
class InstallGenerator < Rails::Generators::Base
include ActiveRecord::Generators::Migration
source_root File.expand_path("templates", __dir__)
+ def add_field_error_proc
+ field_error_proc_code = <<~RUBY
+ # Provides an HTML generator for displaying errors that come from Active Model
+ config.action_view.field_error_proc = Proc.new do |html_tag, instance|
+ raw Nokogiri::HTML.fragment(html_tag).child.add_class("is-invalid")
+ end
+ RUBY
+
+ environment field_error_proc_code
+ end
+
def add_gems
uncomment_lines "Gemfile", /"bcrypt"/
gem "pagy", comment: "Use Pagy to add paginated results [https://github.com/ddnexus/pagy]"
gem "ransack", comment: "Use Ransack to enable the creation of search forms for your application [https://github.com/activerecord-hackery/ransack]"
gem "spreadsheet_architect", comment: "Spreadsheet Architect is a library that allows you to create XLSX, ODS, or CSV spreadsheets super easily [https://github.com/westonganger/spreadsheet_architect]"