Sha256: e1cfc1e39e882a67fd9d2c8c85594eef5da8b637a44f7cb71f348f6405e4abd8
Contents?: true
Size: 1.06 KB
Versions: 18
Compression:
Stored size: 1.06 KB
Contents
require 'rails/generators' module Edgarj class ScaffoldGenerator < Rails::Generators::NamedBase include Rails::Generators::ResourceHelpers source_root File.expand_path('../templates', __FILE__) invoke :model, in: :rails def add_edgarj_routes route "edgarj_resources :#{file_name.pluralize}" end def create_controller_files template 'controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb") end hook_for :test_framework, as: :scaffold hook_for :helper, in: :rails, as: :scaffold do |invoked| invoke invoked, [ controller_name ] end =begin private # copied from TestUnit::Generators::ScaffoldGenerator def attributes_hash return if attributes_names.empty? attributes_names.map do |name| if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?) "#{name}: 'secret'" else "#{name}: @#{singular_table_name}.#{name}" end end.sort.join(', ') end =end end end
Version data entries
18 entries across 18 versions & 1 rubygems