Sha256: 0f035272ff1a26f2a50001f3bd491485d57c9d0bb19bab5b0e037ab064dfa3f9

Contents?: true

Size: 772 Bytes

Versions: 6

Compression:

Stored size: 772 Bytes

Contents

require 'rails/generators/sequel'

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

      check_class_collision

      class_option :autoincrement, :type => :boolean
      class_option :migration, :type => :boolean
      class_option :timestamps, :type => :boolean
      # TODO: parent option?

      def create_migration_file
        return unless options[:migration] && options[:parent].nil?
        migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb"
      end

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

      hook_for :test_framework

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails3_sequel-0.3.1 lib/rails/generators/sequel/model/model_generator.rb
rails3_sequel-0.3.0 lib/rails/generators/sequel/model/model_generator.rb
rails3_sequel-0.2.2 lib/rails/generators/sequel/model/model_generator.rb
rails3_sequel-0.2.1 lib/rails/generators/sequel/model/model_generator.rb
rails3_sequel-0.2.0 lib/rails/generators/sequel/model/model_generator.rb
rails3_sequel-0.1.0 lib/rails/generators/sequel/model/model_generator.rb