Commit a41919bcaa9c4f2c36ffdcc7c719225283a05b37

Configured ORM, testing framework, database.yml and created our first model.

Commit diff

app/models/post.rb

 
1class Post < ActiveRecord::Base
2end
toggle raw diff

config/database.yml

 
1:development: &defaults
2 :adapter: mysql
3 :database: slapp_development
4 :username: slapp
5 :password: SL@ppYin08
6 :host: localhost
7 :socket: /tmp/mysql.sock
8 :encoding: utf8
9
10:test:
11 <<: *defaults
12 :database: slapp_test
toggle raw diff

config/init.rb

 
2424# use_orm :datamapper
2525
2626### Uncomment for ActiveRecord ORM
27# use_orm :activerecord
27use_orm :activerecord
2828
2929### Uncomment for Sequel ORM
3030# use_orm :sequel
3939### merb.
4040###
4141# use_test :test_unit
42# use_test :rspec
42use_test :rspec
4343
4444### Add your other dependencies here
4545
5151# OR
5252# dependencies "RedCloth" => "> 3.0", "ruby-aes-cext" => "= 1.0"
5353
54dependency "merb_helpers"
55
5456Merb::BootLoader.after_app_loads do
5557 ### Add dependencies here that must load after the application loads:
5658
toggle raw diff

schema/migrations/001_post_migration.rb

 
1class PostMigration < ActiveRecord::Migration
2 def self.up
3 create_table :posts do |t|
4 t.string :body
5 t.datetime :created_at
6
7 t.timestamps
8 end
9 end
10
11 def self.down
12 drop_table :posts
13 end
14end
toggle raw diff

schema/schema.rb

 
1# This file is auto-generated from the current state of the database. Instead of editing this file,
2# please use the migrations feature of ActiveRecord to incrementally modify your database, and
3# then regenerate this schema definition.
4#
5# Note that this schema.rb definition is the authoritative source for your database schema. If you need
6# to create the application database on another system, you should be using db:schema:load, not running
7# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8# you'll amass, the slower it'll run and the greater likelihood for issues).
9#
10# It's strongly recommended to check this file into your version control system.
11
12ActiveRecord::Schema.define(:version => 1) do
13
14 create_table "posts", :force => true do |t|
15 t.string "body"
16 t.datetime "created_at"
17 t.datetime "updated_at"
18 end
19
20end
toggle raw diff

spec/models/post_spec.rb

 
1require File.join( File.dirname(__FILE__), "..", "spec_helper" )
2
3describe Post do
4
5 it "should have specs"
6
7end
toggle raw diff