Sha256: 82d206ac11f2c2fd02eb40fae03398d5403de79853b38ce7578b27ff061f59a7

Contents?: true

Size: 789 Bytes

Versions: 11

Compression:

Stored size: 789 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

      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

11 entries across 11 versions & 1 rubygems

Version Path
model_base_generators-0.3.2 lib/model_base/generators/model_support.rb
model_base_generators-0.3.1 lib/model_base/generators/model_support.rb
model_base_generators-0.3.0 lib/model_base/generators/model_support.rb
model_base_generators-0.2.4 lib/model_base/generators/model_support.rb
model_base_generators-0.2.3 lib/model_base/generators/model_support.rb
model_base_generators-0.2.2 lib/model_base/generators/model_support.rb
model_base_generators-0.2.1 lib/model_base/generators/model_support.rb
model_base_generators-0.2.0 lib/model_base/generators/model_support.rb
model_base_generators-0.1.2 lib/model_base/generators/model_support.rb
model_base_generators-0.1.1 lib/model_base/generators/model_support.rb
model_base_generators-0.1.0 lib/model_base/generators/model_support.rb