Sha256: 945aeb50c82bea0f690ce7e88f95ee916326c78bb02445a5ff3870c6a63dee1f
Contents?: true
Size: 796 Bytes
Versions: 11
Compression:
Stored size: 796 Bytes
Contents
module Trestle module Generators class ResourceGenerator < ::Rails::Generators::NamedBase desc "Creates a Trestle admin resource" class_option :singular, type: :boolean, default: false, desc: "Generate a singular resource" source_root File.expand_path("../templates", __FILE__) def create_admin template "admin.rb.erb", File.join("app/admin", class_path, "#{admin_name}_admin.rb") end def admin_name singular? ? singular_name : plural_name end def parameter_name singular_name.singularize end def singular? options[:singular] end protected def module_name class_name.deconstantize end def module? module_name.present? end end end end
Version data entries
11 entries across 11 versions & 1 rubygems