Commit a41919bcaa9c4f2c36ffdcc7c719225283a05b37
- Date: Wed Apr 16 05:57:04 +0000 2008
- Committer: Slurry (socialface@gmail.com)
- Author: Slurry (socialface@gmail.com)
- Commit SHA1: a41919bcaa9c4f2c36ffdcc7c719225283a05b37
- Tree SHA1: 25f8cc85e04622c9efc60a55f790a306d6c7c1e6
Configured ORM, testing framework, database.yml and created our first model.
Commit diff
| |   |
| 1 | class Post < ActiveRecord::Base |
| 2 | end |
| toggle raw diff |
--- /dev/null
+++ b/app/models/post.rb
@@ -0,0 +1,2 @@
+class Post < ActiveRecord::Base
+end
\ No newline at end of file |
| |   |
| 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 |
--- /dev/null
+++ b/config/database.yml
@@ -0,0 +1,12 @@
+:development: &defaults
+ :adapter: mysql
+ :database: slapp_development
+ :username: slapp
+ :password: SL@ppYin08
+ :host: localhost
+ :socket: /tmp/mysql.sock
+ :encoding: utf8
+
+:test:
+ <<: *defaults
+ :database: slapp_test
\ No newline at end of file |
| |   |
| 24 | 24 | # use_orm :datamapper |
| 25 | 25 | |
| 26 | 26 | ### Uncomment for ActiveRecord ORM |
| 27 | | # use_orm :activerecord |
| 27 | use_orm :activerecord |
| 28 | 28 | |
| 29 | 29 | ### Uncomment for Sequel ORM |
| 30 | 30 | # use_orm :sequel |
| … | … | |
| 39 | 39 | ### merb. |
| 40 | 40 | ### |
| 41 | 41 | # use_test :test_unit |
| 42 | | # use_test :rspec |
| 42 | use_test :rspec |
| 43 | 43 | |
| 44 | 44 | ### Add your other dependencies here |
| 45 | 45 | |
| … | … | |
| 51 | 51 | # OR |
| 52 | 52 | # dependencies "RedCloth" => "> 3.0", "ruby-aes-cext" => "= 1.0" |
| 53 | 53 | |
| 54 | dependency "merb_helpers" |
| 55 | |
| 54 | 56 | Merb::BootLoader.after_app_loads do |
| 55 | 57 | ### Add dependencies here that must load after the application loads: |
| 56 | 58 | |
| toggle raw diff |
--- a/config/init.rb
+++ b/config/init.rb
@@ -24,7 +24,7 @@ end
# use_orm :datamapper
### Uncomment for ActiveRecord ORM
-# use_orm :activerecord
+use_orm :activerecord
### Uncomment for Sequel ORM
# use_orm :sequel
@@ -39,7 +39,7 @@ end
### merb.
###
# use_test :test_unit
-# use_test :rspec
+use_test :rspec
### Add your other dependencies here
@@ -51,6 +51,8 @@ end
# OR
# dependencies "RedCloth" => "> 3.0", "ruby-aes-cext" => "= 1.0"
+dependency "merb_helpers"
+
Merb::BootLoader.after_app_loads do
### Add dependencies here that must load after the application loads:
|
| |   |
| 1 | class 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 |
| 14 | end |
| toggle raw diff |
--- /dev/null
+++ b/schema/migrations/001_post_migration.rb
@@ -0,0 +1,14 @@
+class PostMigration < ActiveRecord::Migration
+ def self.up
+ create_table :posts do |t|
+ t.string :body
+ t.datetime :created_at
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :posts
+ end
+end |
| |   |
| 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 | |
| 12 | ActiveRecord::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 | |
| 20 | end |
| toggle raw diff |
--- /dev/null
+++ b/schema/schema.rb
@@ -0,0 +1,20 @@
+# This file is auto-generated from the current state of the database. Instead of editing this file,
+# please use the migrations feature of ActiveRecord 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 => 1) do
+
+ create_table "posts", :force => true do |t|
+ t.string "body"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end |
| |   |
| 1 | require File.join( File.dirname(__FILE__), "..", "spec_helper" ) |
| 2 | |
| 3 | describe Post do |
| 4 | |
| 5 | it "should have specs" |
| 6 | |
| 7 | end |
| toggle raw diff |
--- /dev/null
+++ b/spec/models/post_spec.rb
@@ -0,0 +1,7 @@
+require File.join( File.dirname(__FILE__), "..", "spec_helper" )
+
+describe Post do
+
+ it "should have specs"
+
+end
\ No newline at end of file |