Sha256: b58e5795514d93aa5d362c126d7f94f2811821581298a49f2c0daf9ccbf56399

Contents?: true

Size: 749 Bytes

Versions: 5

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

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

5 entries across 5 versions & 1 rubygems

Version Path
mobile_workflow-0.12.2 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.12.1 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.12.0 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.11.1 lib/generators/mobile_workflow/model_generator.rb
mobile_workflow-0.11.0 lib/generators/mobile_workflow/model_generator.rb