Sha256: 7d4c75bd002d4ce2c236841da1f39858fea5e4c0876192ec8e6e54516638498b
Contents?: true
Size: 538 Bytes
Versions: 44
Compression:
Stored size: 538 Bytes
Contents
require 'rails/generators/active_record' module ScaffoldPlus module Generators class AutofocusGenerator < ActiveRecord::Generators::Base desc "Add autofocus to view" argument :name, type: :string, desc: "The object to be updated" argument :column, type: :string, desc: 'The column name to be focused' def add_to_view file = "app/views/#{table_name}/_form.html.erb" gsub_file file, /(:#{column}) %>/, "\\1, autofocus: true %>" end end end end
Version data entries
44 entries across 44 versions & 1 rubygems