Sha256: 55e782aa3f210e5833b430780db52ed6462a5a817041c06ccaeb3e4ca5538d15

Contents?: true

Size: 634 Bytes

Versions: 5

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators/active_record'

module Monarchy
  class ResourceGenerator < Rails::Generators::NamedBase
    include Rails::Generators::Migration

    desc 'This generator creates a resourcify model'
    source_root File.expand_path('../../templates', __FILE__)

    def create_resource_file
      template 'models/resource.rb', "app/models/#{file_name}.rb"
      migration_template 'migrations/resource.rb', "db/migrate/create_#{file_name}_resource.rb"
    end

    def self.next_migration_number(dirname)
      ActiveRecord::Generators::Base.next_migration_number(dirname)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
monarchy-2.4.0 lib/generators/monarchy/resource_generator.rb
monarchy-2.3.0 lib/generators/monarchy/resource_generator.rb
monarchy-2.2.2 lib/generators/monarchy/resource_generator.rb
monarchy-2.2.1 lib/generators/monarchy/resource_generator.rb
monarchy-2.2.0 lib/generators/monarchy/resource_generator.rb