Sha256: 94195d1d88c037b946a7780d709cdf1e27255c63dd9568871649b3d8b25dc3c1

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal

class BaseControllerGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('templates', __dir__)
  
  check_class_collision suffix: "Controller"

  desc "This generator creates a base controller for the named namespace"

  def ensure_file
    template "base_controller.rb.erb", 
             File.join("app", "controllers", plural_file_name, "base_controller.rb")
  end
  
  private
  
  
  def namespace_module
    file_name.to_s.split("/").first.classify.pluralize
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
orthodox-0.3.0 lib/generators/base_controller/base_controller_generator.rb