Sha256: 7c7598c7e67a5e0b9d4ce28dade7c56766a3cd347f54a179169f8f6e154fd06b
Contents?: true
Size: 785 Bytes
Versions: 21
Compression:
Stored size: 785 Bytes
Contents
require 'rails/generators/active_record' module Migrant class Model < ActiveRecord::Generators::Base argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" desc "The migrant:model generator creates a skeleton ActiveRecord model for use with Migrant." source_root File.expand_path("../templates", __FILE__) def create_model_file template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") end hook_for :test_framework def protip puts "\nNow, go and edit app/models/#{file_name}.rb and/or generate more models, then run 'rake db:upgrade' to generate your schema." end protected def parent_class_name options[:parent] || "ActiveRecord::Base" end end end
Version data entries
21 entries across 21 versions & 1 rubygems