Sha256: e518d0db36fdb0d4474fd4a80e77054a6aa6cc5d1bfeb16a89710c5dc90355c3
Contents?: true
Size: 943 Bytes
Versions: 3
Compression:
Stored size: 943 Bytes
Contents
require 'rails/generators/named_base' module Coalla module Cms class CreateAdminAdministratorsGenerator < Rails::Generators::NamedBase argument :name, type: :string, default: '' source_root File.expand_path('../templates', __FILE__) def setup_directory copy_file 'controllers/admin/administrators_controller.rb', 'app/controllers/admin/administrators_controller.rb' directory 'views/admin/administrators', 'app/views/admin/administrators' inject_into_file 'config/structure.rb', "section Administrator, description: I18n.t('activerecord.structure.administrator'), icon: 'glyphicon glyphicon-home'", before: /^/ end def setup_routes sentinel = /namespace :admin do\s*$/ routing_code = ' resources :administrators' in_root do inject_into_file 'config/routes.rb', "\n #{routing_code}", {after: sentinel} end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems