Sha256: 43d93c7cc8d315c6aef794b34a32e7bbf7af8c7a5bb33a1f73d03705f27ac6d6

Contents?: true

Size: 832 Bytes

Versions: 19

Compression:

Stored size: 832 Bytes

Contents

require 'generators/sequel'

module Sequel
  module Generators
    class ModelGenerator < Base
      argument :attributes, :type => :array, :default => [], :banner => 'field:type field:type'

      check_class_collision

      class_option :migration,  :type => :boolean
      class_option :timestamps, :type => :boolean
      class_option :parent,     :type => :string, :desc => 'The parent class for the generated model'

      def create_migration_file
        migration_template(
          'migration.rb.erb',
          File.join('db', 'migrate', "create_#{table_name}.rb")
        ) if options[:migration]
      end

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

      hook_for :test_framework
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sequel-rails-0.9.17 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.16 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.15 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.14 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.13 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.12 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.11 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.10 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.9 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.8 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.7 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.6 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.5 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.4 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.3 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.2 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.1 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.9.0 lib/generators/sequel/model/model_generator.rb
sequel-rails-0.8.0 lib/generators/sequel/model/model_generator.rb