Sha256: ea67d057dcb4080ac29490309c06b8939ceb4f791132cc84face6ffe4477d16c

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

# This will generate an ORM 'model' for your application based on the specified ORM you're using. 
# 
# Example without columns:
#   rake generate:model name=user
# 
# app/models/user.rb:
#   class User < ActiveRecord::Base
#   end
# db/migrations/<number>_create_users.rb:
#   class CreateUsers < ActiveRecord::Migration
#     self.up
#     end
# 
#     self.down
#     end
#   end
# 
# Example with columns:
#   rake generate:model name=user cols=username:string,email_address:string,created_at:datetime,updated_at:datetime
# 
# app/models/user.rb:
#   class User < ActiveRecord::Base
#   end
# db/migrations/<number>_create_users.rb:
#   class CreateUsers < ActiveRecord::Migration
#     self.up
#       create_table :users do |t|
#         t.column :username, :string
#         t.column :email_address, :string
#         t.column :created_at, :datetime
#         t.column :updated_at, :datetime
#     end
# 
#     self.down
#       drop_table :users
#     end
#   end
class ModelGenerator < Genosaurus
  
  require_param :name

  def after_generate # :nodoc:
    MigrationGenerator.run(@options.merge({"name" => "create_#{param(:name).plural}"}))
  end
  
  def testing_framework # :nodoc:
    app_config.mack.testing_framework
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mack-active_record-0.6.0 lib/model_generator/model_generator.rb
mack-active_record-0.6.1.1 lib/mack-active_record/model_generator/model_generator.rb
mack-active_record-0.6.0.1 lib/model_generator/model_generator.rb
mack-active_record-0.7.0 lib/mack-active_record/model_generator/model_generator.rb
mack-active_record-0.7.1.1 lib/mack-active_record/model_generator/model_generator.rb
mack-active_record-0.6.1.2 lib/mack-active_record/model_generator/model_generator.rb
mack-active_record-0.7.0.1 lib/mack-active_record/model_generator/model_generator.rb
mack-active_record-0.6.1 lib/mack-active_record/model_generator/model_generator.rb
mack-active_record-0.7.1 lib/mack-active_record/model_generator/model_generator.rb