Sha256: 08e8d89ed5d2f23bd1bac4c01712fdc6127cd21239b5d1341be2c90deeddbcf1
Contents?: true
Size: 986 Bytes
Versions: 8
Compression:
Stored size: 986 Bytes
Contents
require 'model_base' require 'rails/generators' module ModelBase module Generators module ModelSupport def self.included(klass) klass.send :include, ::Rails::Generators::ResourceHelpers end def initialize(args, *options) super(args, *options) @model_name = (class_path + [@name.singularize.camelize]).join('::') unless @model_name @model_name = @model_name.camelize end def template(src, dest, *args, &block) if ModelBase.skipped_file?(dest) $stderr.puts("\e[34m#{dest} was SKIPPED\e[0m") return end super end protected def model @model ||= ModelBase::MetaModel.new(@model_name) end def controller_routing_path ActiveModel::Naming.route_key(@model_name.constantize) end def singular_controller_routing_path ActiveModel::Naming.singular_route_key(@model_name.constantize) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems