Sha256: 41ae507a66a9b8df93f3371bc6ee20da33e0b91a8d7086bd32cb34d3b0bb3203
Contents?: true
Size: 745 Bytes
Versions: 12
Compression:
Stored size: 745 Bytes
Contents
require "godmin/generators/named_base" class Godmin::ResourceGenerator < Godmin::Generators::NamedBase argument :attributes, type: :array, default: [], banner: "attribute attribute" def add_route route "resources :#{file_name.pluralize}" end def add_navigation append_to_file File.join("app/views", namespaced_path, "shared/_navigation.html.erb") do <<-END.strip_heredoc <%= navbar_item #{class_name} %> END end end def create_controller template "resource_controller.rb", File.join("app/controllers", class_path, "#{file_name.pluralize}_controller.rb") end def create_service template "resource_service.rb", File.join("app/services", class_path, "#{file_name}_service.rb") end end
Version data entries
12 entries across 12 versions & 1 rubygems