Sha256: 371cb4d9d3556a9a4ca1efb499b529429662a796712a235d523c54dc220d672d

Contents?: true

Size: 686 Bytes

Versions: 8

Compression:

Stored size: 686 Bytes

Contents

require 'rails/generators/active_record/model/model_generator'

module MobileWorkflow
  module Generators

    class ModelGenerator < ActiveRecord::Generators::ModelGenerator
      source_root File.join(File.dirname(ActiveRecord::Generators::ModelGenerator.instance_method(:create_migration_file).source_location.first), "templates")

      class_option :doorkeeper_oauth, type: :boolean, default: false

      def create_model_file
        template File.join(File.dirname(__FILE__), "templates", "model.rb.erb"), File.join('app/models', class_path, "#{file_name}.rb")
      end

      private

      def doorkeeper_oauth?
        options[:doorkeeper_oauth]
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mobile_workflow-0.10.2 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.10.1 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.10.0 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.9.0 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.8.9 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.7.9 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.7.8 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.7.7 lib/generators/mobile_workflow/model_generator.rb