summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhukl <hukl@eight.local>2009-02-08 15:15:43 +0100
committerhukl <hukl@eight.local>2009-02-08 15:15:43 +0100
commita6eea1a843c29112a737e77d6cb813c8980fb836 (patch)
tree36433d2027e930404ccb11c61396aba9b3794fb8
parentbb9d9ccd57ce5673b52a1856dfd32337f4ae4b22 (diff)
added basic user model and user_id on page model
to introduce the concept of authors.
-rw-r--r--app/models/user.rb2
-rw-r--r--db/migrate/20090208130829_create_users.rb16
-rw-r--r--db/migrate/20090208130906_add_user_id_to_pages.rb9
-rw-r--r--test/fixtures/users.yml13
-rw-r--r--test/unit/user_test.rb8
5 files changed, 48 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 0000000..4a57cf0
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,2 @@
1class User < ActiveRecord::Base
2end
diff --git a/db/migrate/20090208130829_create_users.rb b/db/migrate/20090208130829_create_users.rb
new file mode 100644
index 0000000..e91193c
--- /dev/null
+++ b/db/migrate/20090208130829_create_users.rb
@@ -0,0 +1,16 @@
1class CreateUsers < ActiveRecord::Migration
2 def self.up
3 create_table :users do |t|
4 t.string :login
5 t.string :email
6 t.string :crypted_password
7 t.string :salt
8
9 t.timestamps
10 end
11 end
12
13 def self.down
14 drop_table :users
15 end
16end
diff --git a/db/migrate/20090208130906_add_user_id_to_pages.rb b/db/migrate/20090208130906_add_user_id_to_pages.rb
new file mode 100644
index 0000000..02ebdef
--- /dev/null
+++ b/db/migrate/20090208130906_add_user_id_to_pages.rb
@@ -0,0 +1,9 @@
1class AddUserIdToPages < ActiveRecord::Migration
2 def self.up
3 add_column :pages, :user_id, :integer
4 end
5
6 def self.down
7 add_column :pages, :user_id
8 end
9end
diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml
new file mode 100644
index 0000000..74fafbd
--- /dev/null
+++ b/test/fixtures/users.yml
@@ -0,0 +1,13 @@
1# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
3one:
4 login: MyString
5 email: MyString
6 crypted_password: MyString
7 salt: MyString
8
9two:
10 login: MyString
11 email: MyString
12 crypted_password: MyString
13 salt: MyString
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
new file mode 100644
index 0000000..a64d2d3
--- /dev/null
+++ b/test/unit/user_test.rb
@@ -0,0 +1,8 @@
1require 'test_helper'
2
3class UserTest < ActiveSupport::TestCase
4 # Replace this with your real tests.
5 test "the truth" do
6 assert true
7 end
8end