+ <%= f.submit 'Paste it!', class: 'btn btn-primary' %>
+<% end %>
diff --git a/app/views/pastes/edit.html.erb b/app/views/pastes/edit.html.erb
index e99d6e3..3df5e88 100644
--- a/app/views/pastes/edit.html.erb
+++ b/app/views/pastes/edit.html.erb
@@ -1 +1,3 @@
Edit
+
+<% render '_form' %>
diff --git a/app/views/pastes/index.html.erb b/app/views/pastes/index.html.erb
index 8ab686e..91d18f3 100644
--- a/app/views/pastes/index.html.erb
+++ b/app/views/pastes/index.html.erb
@@ -1 +1,3 @@
-Hello, World!
+<% @pastes.each do |paste| %>
+ <%= link_to paste.id, paste %>
+<% end %>
diff --git a/app/views/pastes/new.html.erb b/app/views/pastes/new.html.erb
index 96716fb..23997ae 100644
--- a/app/views/pastes/new.html.erb
+++ b/app/views/pastes/new.html.erb
@@ -1 +1 @@
-New
+<%= render partial: 'form' %>
diff --git a/app/views/pastes/show.html.erb b/app/views/pastes/show.html.erb
new file mode 100644
index 0000000..b8088ab
--- /dev/null
+++ b/app/views/pastes/show.html.erb
@@ -0,0 +1 @@
+<%= @paste.content %>
diff --git a/db/migrate/20140214151745_create_pastes.rb b/db/migrate/20140214151745_create_pastes.rb
new file mode 100644
index 0000000..565139c
--- /dev/null
+++ b/db/migrate/20140214151745_create_pastes.rb
@@ -0,0 +1,8 @@
+class CreatePastes < ActiveRecord::Migration
+ def change
+ create_table :pastes do |t|
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140214152056_add_content_to_pastes.rb b/db/migrate/20140214152056_add_content_to_pastes.rb
new file mode 100644
index 0000000..ead6aa9
--- /dev/null
+++ b/db/migrate/20140214152056_add_content_to_pastes.rb
@@ -0,0 +1,5 @@
+class AddContentToPastes < ActiveRecord::Migration
+ def change
+ add_column :pastes, :content, :string
+ end
+end
diff --git a/db/migrate/20140214185753_change_content_type_in_pastes.rb b/db/migrate/20140214185753_change_content_type_in_pastes.rb
new file mode 100644
index 0000000..23101d5
--- /dev/null
+++ b/db/migrate/20140214185753_change_content_type_in_pastes.rb
@@ -0,0 +1,9 @@
+class ChangeContentTypeInPastes < ActiveRecord::Migration
+ def self.up
+ change_column :pastes, :content, :text
+ end
+
+ def self.down
+ change_column :pastes, :content, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
new file mode 100644
index 0000000..6ce463f
--- /dev/null
+++ b/db/schema.rb
@@ -0,0 +1,22 @@
+# encoding: UTF-8
+# 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 that you check this file into your version control system.
+
+ActiveRecord::Schema.define(version: 20140214185753) do
+
+ create_table "pastes", force: true do |t|
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.text "content", limit: 255
+ end
+
+end
diff --git a/spec/features/creates_new_paste_spec.rb b/spec/features/creates_new_paste_spec.rb
new file mode 100644
index 0000000..c2962e9
--- /dev/null
+++ b/spec/features/creates_new_paste_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+feature 'Creates new paste' do
+ scenario 'with valid content' do
+ visit new_paste_path
+ fill_in 'Content', with: 'Test'
+ click_button 'Paste it!'
+
+ expect(page).to have_content('Your paste has been added')
+ end
+
+ scenario 'with blank content' do
+ visit new_paste_path
+ fill_in 'Content', with: ' '
+ click_button 'Paste it!'
+
+ expect(page).to have_content('There was an error submitting your form')
+ end
+end
diff --git a/spec/models/paste_spec.rb b/spec/models/paste_spec.rb
new file mode 100644
index 0000000..0ab08e4
--- /dev/null
+++ b/spec/models/paste_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe Paste do
+ before do
+ @paste = Paste.new(content: "Test")
+ end
+
+ subject { @paste }
+
+ it { should respond_to(:content) }
+
+ it { should be_valid }
+
+ describe "when content is blank" do
+ before { @paste.content = " " }
+ it { should_not be_valid }
+ end
+end