Sha256: e35a78e95c2732df962c66f1202f4a24870cfe7ea74668c6cf2138a397289b82

Contents?: true

Size: 633 Bytes

Versions: 13

Compression:

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

13 entries across 13 versions & 1 rubygems

Version Path
monarchy-2.1.0 lib/generators/monarchy/resource_generator.rb
monarchy-2.0.8 lib/generators/monarchy/resource_generator.rb
monarchy-2.0.7 lib/generators/monarchy/resource_generator.rb
monarchy-2.0.6 lib/generators/monarchy/resource_generator.rb
monarchy-2.0.5 lib/generators/monarchy/resource_generator.rb
monarchy-2.0.4 lib/generators/monarchy/resource_generator.rb
monarchy-2.0.0.pre.beta.1 lib/generators/monarchy/resource_generator.rb
monarchy-1.1.5 lib/generators/monarchy/resource_generator.rb
monarchy-1.1.4 lib/generators/monarchy/resource_generator.rb
monarchy-1.1.3 lib/generators/monarchy/resource_generator.rb
monarchy-1.0.0 lib/generators/monarchy/resource_generator.rb
monarchy-0.3.1 lib/generators/monarchy/resource_generator.rb
monarchy-0.2.1 lib/generators/monarchy/resource_generator.rb