Sha256: f66d56d435f9f63b7a1a5de875c72396f0436c67cc3506af0913f66c0e975a21
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true require 'rails/generators/named_base' module Kingsman module Generators class KingsmanGenerator < Rails::Generators::NamedBase include Rails::Generators::ResourceHelpers namespace "kingsman" source_root File.expand_path("../templates", __FILE__) desc "Generates a model with the given NAME (if one does not exist) with kingsman " \ "configuration plus a migration file and kingsman routes." hook_for :orm, required: true class_option :routes, desc: "Generate routes", type: :boolean, default: true def add_kingsman_routes kingsman_route = "kingsman_for :#{plural_name}".dup kingsman_route << %Q(, class_name: "#{class_name}") if class_name.include?("::") kingsman_route << %Q(, skip: :all) unless options.routes? route kingsman_route end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kingsman-0.1.1 | lib/generators/kingsman/kingsman_generator.rb |
kingsman-0.1.0 | lib/generators/kingsman/kingsman_generator.rb |