Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Commit

Permalink
generated models with
Browse files Browse the repository at this point in the history
  $ r g active_record:model todo title:string done:boolean
  $ r g model todo_log title:string done:boolean

and add schema options: :null, :default
  • Loading branch information
a2ikm committed Jul 30, 2011
1 parent a0de08b commit 8d8e9f6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/todo.rb
@@ -0,0 +1,2 @@
class Todo < ActiveRecord::Base
end
5 changes: 5 additions & 0 deletions app/models/todo_log.rb
@@ -0,0 +1,5 @@
class TodoLog
include Mongoid::Document
field :title, :type => String
field :done, :type => Boolean
end
14 changes: 14 additions & 0 deletions db/migrate/20110730071022_create_todos.rb
@@ -0,0 +1,14 @@
class CreateTodos < ActiveRecord::Migration
def self.up
create_table :todos do |t|
t.string :title, :null => false
t.boolean :done, :null => false, :default => false

t.timestamps
end
end

def self.down
drop_table :todos
end
end
22 changes: 22 additions & 0 deletions db/schema.rb
@@ -0,0 +1,22 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20110730071022) do

create_table "todos", :force => true do |t|
t.string "title", :null => false
t.boolean "done", :default => false, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end

end

0 comments on commit 8d8e9f6

Please sign in to comment.