Sha256: 0ed52d946515d94227a54e6c549580cfbbd0ec214649b4afc3b3c1a73647f479
Contents?: true
Size: 911 Bytes
Versions: 1
Compression:
Stored size: 911 Bytes
Contents
require 'generators/active_record' module ActiveRecord 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 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 protected def parent_class_name options[:parent] || "ActiveRecord::Base" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-3.0.0.beta | lib/generators/active_record/model/model_generator.rb |