Skip to content

Commit c68f7b1

Browse files
committed
seeds file
1 parent ba8e095 commit c68f7b1

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ gem 'jbuilder', '~> 2.0'
2424
gem 'sdoc', '~> 0.4.0', group: :doc
2525

2626
# Use ActiveModel has_secure_password
27-
# gem 'bcrypt', '~> 3.1.7'
27+
gem 'bcrypt', '~> 3.1.7'
2828

2929
# Use Unicorn as the app server
3030
# gem 'unicorn'

Gemfile.lock

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ GEM
3737
thread_safe (~> 0.1)
3838
tzinfo (~> 1.1)
3939
arel (6.0.0)
40+
bcrypt (3.1.9)
4041
binding_of_caller (0.7.2)
4142
debug_inspector (>= 0.0.1)
4243
builder (3.2.2)
@@ -149,6 +150,7 @@ PLATFORMS
149150
ruby
150151

151152
DEPENDENCIES
153+
bcrypt (~> 3.1.7)
152154
byebug
153155
coffee-rails (~> 4.1.0)
154156
jbuilder (~> 2.0)

app/models/user.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
class User < ActiveRecord::Base
2+
has_secure_password
23
end

db/schema.rb

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# encoding: UTF-8
2+
# This file is auto-generated from the current state of the database. Instead
3+
# of editing this file, please use the migrations feature of Active Record to
4+
# incrementally modify your database, and then regenerate this schema definition.
5+
#
6+
# Note that this schema.rb definition is the authoritative source for your
7+
# database schema. If you need to create the application database on another
8+
# system, you should be using db:schema:load, not running all the migrations
9+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
10+
# you'll amass, the slower it'll run and the greater likelihood for issues).
11+
#
12+
# It's strongly recommended that you check this file into your version control system.
13+
14+
ActiveRecord::Schema.define(version: 20141209144846) do
15+
16+
create_table "comments", force: true do |t|
17+
t.string "comment"
18+
t.integer "score"
19+
t.integer "user_id"
20+
t.integer "link_id"
21+
t.datetime "created_at", null: false
22+
t.datetime "updated_at", null: false
23+
end
24+
25+
create_table "links", force: true do |t|
26+
t.string "link"
27+
t.integer "score"
28+
t.integer "section_id"
29+
t.integer "user_id"
30+
t.datetime "created_at", null: false
31+
t.datetime "updated_at", null: false
32+
end
33+
34+
create_table "sections", force: true do |t|
35+
t.string "name"
36+
t.datetime "created_at", null: false
37+
t.datetime "updated_at", null: false
38+
end
39+
40+
create_table "users", force: true do |t|
41+
t.string "password_digest"
42+
t.string "username"
43+
t.datetime "created_at", null: false
44+
t.datetime "updated_at", null: false
45+
end
46+
47+
end

db/seeds.rb

+5
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@
55
#
66
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
77
# Mayor.create(name: 'Emanuel', city: cities.first)
8+
[User, Comment, Link, Section].each { |m| m.destroy_all }
9+
User.create!(:password =>"123456", :username => "fooguy")
10+
Comment.create!(:comment => "bad search engine", :score => -1, :user_id => 1, :link_id => 1)
11+
Link.create!(:link=>"http://www.google.fi", :score => 1, :section_id => 1, :user_id => 1)
12+
Section.create!(:name => "Main")

0 commit comments

Comments
 (0)