Submitted Lab3

parent 81711d48
...@@ -9,13 +9,14 @@ module Admin ...@@ -9,13 +9,14 @@ module Admin
def edit def edit
@post = Post.find(params[:id]) @post = Post.find(params[:id])
@user = @post.user
end end
def update def update
@post = Post.find(params[:id]) @post = Post.find(params[:id])
if @post.update(post_params()) if @post.update(post_params())
redirect_to post_path(@post.id) redirect_to admin_post_path(@post.id)
else else
render "admin/posts/edit.html.erb" render "admin/posts/edit.html.erb"
end end
...@@ -27,8 +28,9 @@ module Admin ...@@ -27,8 +28,9 @@ module Admin
end end
def create def create
@post = Post.new(post_params()) @post = current_user.posts.new(post_params)
@user = current_user
@users = User.all
if @post.save if @post.save
redirect_to post_path(@post.id) redirect_to post_path(@post.id)
else else
...@@ -38,7 +40,8 @@ module Admin ...@@ -38,7 +40,8 @@ module Admin
def show def show
@post = Post.find(params[:id]) @post = Post.find(params[:id])
@user = post.user
@users = User.all
render "admin/posts/show.html.erb" render "admin/posts/show.html.erb"
end end
......
...@@ -7,6 +7,7 @@ class PostsController < ApplicationController ...@@ -7,6 +7,7 @@ class PostsController < ApplicationController
def edit def edit
@post = Post.find(params[:id]) @post = Post.find(params[:id])
@user = @post.user
end end
def update def update
...@@ -25,7 +26,9 @@ class PostsController < ApplicationController ...@@ -25,7 +26,9 @@ class PostsController < ApplicationController
end end
def create def create
@post = Post.new(post_params()) @post = current_user.posts.new(post_params)
@user = current_user
@users = User.all
if @post.save if @post.save
redirect_to post_path(@post.id) redirect_to post_path(@post.id)
...@@ -36,7 +39,8 @@ class PostsController < ApplicationController ...@@ -36,7 +39,8 @@ class PostsController < ApplicationController
def show def show
@post = Post.find(params[:id]) @post = Post.find(params[:id])
@user = @post.user
@users = User.all
render "posts/show.html.erb" render "posts/show.html.erb"
end end
......
class UserControll < ApplicationController
def posts
@user = User.find(params[:id])
@posts = @user
end
end
\ No newline at end of file
<%= simple_form_for([:admin, @post]) do |f| %> <%= simple_form_for([:admin, @post]) do |f| %>
<%= f.input :title %> <%= f.input :title %>
<%= f.association :category %> <%= f.association :category, as: :select, collection: ["a", "b", "c"] %>
<%= f.input :published_at %> <%= f.input :published_at %>
<%= f.input :content %> <%= f.input :content %>
<%= f.input :is_published %> <%= f.input :is_published %>
......
...@@ -7,13 +7,15 @@ ...@@ -7,13 +7,15 @@
<table width="100%"> <table width="100%">
<tr> <tr>
<th>Title</th> <th>Title</th>
<th>Published by </th>
<th>Published At</th> <th>Published At</th>
<th>Pusblished?</th> <th>Published?</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
<% @posts.each do |post| %> <% @posts.each do |post| %>
<tr> <tr>
<td><%= post.title %></td> <td><%= post.title %></td>
<td><%= post.user.email %> </td>
<td><%= post.published_at %></td> <td><%= post.published_at %></td>
<td><%= post.is_published %></td> <td><%= post.is_published %></td>
<td> <td>
...@@ -24,3 +26,5 @@ ...@@ -24,3 +26,5 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<hr>
<%= link_to "Home", root_path %>
<h1><%= @post.title %></h1> <h1><%= @post.title %></h1>
<h3><%= @post.published_at %></h3> <h3><%= @post.published_at %></h3>
<h4>by <%= current_user.email %> </h4> <h4>by <%= user.email %> </h4>
<p> <p>
<%= @post.content %> <%= @post.content %>
......
<h2>Resend confirmation instructions</h2>
<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<%= f.full_error :confirmation_token %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Resend confirmation instructions" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
<h2>Change your password</h2>
<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>
<%= f.input :reset_password_token, as: :hidden %>
<%= f.full_error :reset_password_token %>
<div class="form-inputs">
<%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Change my password" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
<h2>Forgot your password?</h2>
<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Send me reset password instructions" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
<% end %>
<%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
<%= f.input :password_confirmation, required: false %>
<%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Update" %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>
<h2>Sign up</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, required: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
<h2>Log in</h2>
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-inputs">
<%= f.input :email, required: false, autofocus: true %>
<%= f.input :password, required: false %>
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
</div>
<div class="form-actions">
<%= f.button :submit, "Log in" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>
<h2>Resend unlock instructions</h2>
<%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<%= f.full_error :unlock_token %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Resend unlock instructions" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<% end %> <% end %>
<hr> <hr>
<% @categories.each do |c| %> <% @categories.each do |c| %>
<h2>(<%= c.id %>) <%= c.name %></h2> <h2>(<%= c.id %>) <%= c.name %></h2>
<ul> <ul>
<% c.posts.each do |p| %> <% c.posts.each do |p| %>
...@@ -23,5 +23,7 @@ ...@@ -23,5 +23,7 @@
<% end %> <% end %>
</ul> </ul>
<%= link_to "View all Posts", "/categories/#{c.id}" %> <%= link_to "View all Posts", "/categories/#{c.id}" %>
<% end %> <% end %>
...@@ -5,19 +5,25 @@ ...@@ -5,19 +5,25 @@
<%= link_to"Log out", destroy_user_session_path, :method => :delete %> <%= link_to"Log out", destroy_user_session_path, :method => :delete %>
<hr> <hr>
<%= link_to "Edit Posts", admin_posts_path %> <%= link_to "Edit Posts", admin_posts_path %>
<hr>
<table width="100%"> <table width="100%">
<tr> <tr>
<th>Title</th> <th>Title</th>
<th>Category</th> <th>Published by</th>
<th>Published At</th> <th>Published At</th>
<th>Pusblished?</th> <th>Published?</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
<% @posts.each do |post| %> <% @posts.each do |post| %>
<hr>
<tr> <tr>
<td><%= post.title %></td> <td><%= post.title %></td>
<td><%= post.category.name %></td> <td><%= post.user.email %></td>
<td><%= post.published_at %></td> <td><%= post.published_at %></td>
<td><%= post.is_published %></td> <td><%= post.is_published %></td>
...@@ -25,6 +31,7 @@ ...@@ -25,6 +31,7 @@
<%= link_to "Show", post_path(post.id) %> <%= link_to "Show", post_path(post.id) %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<% else %> <% else %>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<% if user_signed_in? %> <% if user_signed_in? %>
<h1><%= @post.title %></h1> <h1><%= @post.title %></h1>
<h2>Published by:<%= @user.email %></h2>
<h3><%= @post.published_at %></h3><p> <h3><%= @post.published_at %></h3><p>
<%= @post.content %> <%= @post.content %>
</p> </p>
......
<% @posts.each do |post| %>
<%= post.inspect %>
<% end %>
\ No newline at end of file
...@@ -3,7 +3,7 @@ Rails.application.routes.draw do ...@@ -3,7 +3,7 @@ Rails.application.routes.draw do
root to: "pages#index" root to: "pages#index"
resources :posts resources :posts
get "/categories/:id", to: "categories#show" get "/categories/:id", to: "categories#show"
get 'users/:id/posts' => 'users#posts', :as => :user_posts
namespace :admin do namespace :admin do
resources :posts resources :posts
......
class AddUserId < ActiveRecord::Migration
def change
add_column :posts, :user_id, :integer
end
end
class AddUserId < ActiveRecord::Migration
def change
add_column :posts, :user_id, :integer
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160716072931) do ActiveRecord::Schema.define(version: 20160717025302) do
create_table "categories", force: :cascade do |t| create_table "categories", force: :cascade do |t|
t.string "name" t.string "name"
...@@ -27,6 +27,7 @@ ActiveRecord::Schema.define(version: 20160716072931) do ...@@ -27,6 +27,7 @@ ActiveRecord::Schema.define(version: 20160716072931) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.integer "category_id" t.integer "category_id"
t.integer "user_id"
end end
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
......
Started GET "/" for ::1 at 2016-07-16 18:40:16 +0800
ActiveRecord::PendingMigrationError (
Migrations are pending. To resolve this issue, run:
bin/rake db:migrate RAILS_ENV=development
):
activerecord (4.2.5) lib/active_record/migration.rb:392:in `check_pending!'
activerecord (4.2.5) lib/active_record/migration.rb:373:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.5) lib/rails/engine.rb:518:in `call'
railties (4.2.5) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.0ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.0ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (1381.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/_markup.html.erb (0.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (1.0ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript (1297.4ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript (0.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.5ms)
Rendered C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (2858.6ms)
 (209.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
 (0.0ms) select sqlite_version(*)
 (76.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
Migrating to CreatePosts (20160716012057)
 (0.0ms) begin transaction
 (3.5ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "content" text, "published_at" date, "is_published" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
SQL (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716012057"]]
 (92.1ms) commit transaction
Migrating to AddCategoryToPosts (20160716012128)
 (0.0ms) begin transaction
 (1.5ms) ALTER TABLE "posts" ADD "category" varchar
SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716012128"]]
 (76.9ms) commit transaction
Migrating to ChangePostsTable (20160716012257)
 (0.0ms) begin transaction
 (1.0ms) CREATE TEMPORARY TABLE "aposts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "content" text, "published_at" date, "is_published" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "category" varchar)
 (0.0ms) SELECT * FROM "posts"
 (1.0ms) DROP TABLE "posts"
 (0.5ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "content" text, "published_at" date, "is_published" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
 (0.0ms) SELECT * FROM "aposts"
 (1.5ms) DROP TABLE "aposts"
 (0.5ms) ALTER TABLE "posts" ADD "category_id" integer
SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716012257"]]
 (134.2ms) commit transaction
Migrating to CreateCategories (20160716012329)
 (0.0ms) begin transaction
 (1.0ms) CREATE TABLE "categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
SQL (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716012329"]]
 (108.1ms) commit transaction
Migrating to DeviseCreateUsers (20160716013616)
 (0.0ms) begin transaction
 (1.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
 (1.0ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
 (0.0ms) SELECT sql
FROM sqlite_master
WHERE name='index_users_on_email' AND type='index'
UNION ALL
SELECT sql
FROM sqlite_temp_master
WHERE name='index_users_on_email' AND type='index'
 (0.0ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716013616"]]
 (103.7ms) commit transaction
Migrating to AddUserToPosts (20160716050109)
 (0.5ms) begin transaction
 (1.5ms) ALTER TABLE "posts" ADD "user" varchar
SQL (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716050109"]]
 (142.3ms) commit transaction
Migrating to AddUserIdToPosts (20160716055326)
 (0.0ms) begin transaction
 (5.0ms) ALTER TABLE "posts" ADD "user_id" integer
SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160716055326"]]
 (155.4ms) commit transaction
ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
 (0.0ms)  SELECT sql
FROM sqlite_master
WHERE name='index_users_on_reset_password_token' AND type='index'
UNION ALL
SELECT sql
FROM sqlite_temp_master
WHERE name='index_users_on_reset_password_token' AND type='index'

 (0.0ms) SELECT sql
FROM sqlite_master
WHERE name='index_users_on_email' AND type='index'
UNION ALL
SELECT sql
FROM sqlite_temp_master
WHERE name='index_users_on_email' AND type='index'
Started GET "/" for ::1 at 2016-07-16 19:06:47 +0800
ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by PagesController#index as HTML
Category Load (0.0ms) SELECT "categories".* FROM "categories"
Rendered pages/index.html.erb within layouts/application (15.5ms)
Completed 200 OK in 1172ms (Views: 1122.4ms | ActiveRecord: 0.0ms)
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-07-16 19:06:49 +0800
Started GET "/assets/jquery_ujs.self-e87806d0cf4489aeb1bb7288016024e8de67fd18db693fe026fe3907581e53cd.js?body=1" for ::1 at 2016-07-16 19:06:49 +0800
Started GET "/assets/turbolinks.self-c5acd7a204f5f25ce7a1d8a0e4d92e28d34c9e2df2c7371cd7af88e147e4ad82.js?body=1" for ::1 at 2016-07-16 19:06:49 +0800
Started GET "/assets/application.self-3b8dabdc891efe46b9a144b400ad69e37d7e5876bdc39dee783419a69d7ca819.js?body=1" for ::1 at 2016-07-16 19:06:49 +0800
Started GET "/assets/jquery.self-660adc51e0224b731d29f575a6f1ec167ba08ad06ed5deca4f1e8654c135bf4c.js?body=1" for ::1 at 2016-07-16 19:06:49 +0800
Started GET "/posts" for ::1 at 2016-07-16 19:06:54 +0800
Processing by PostsController#index as HTML
Post Load (0.5ms) SELECT "posts".* FROM "posts"
Rendered posts/index.html.erb within layouts/application (3.5ms)
Completed 200 OK in 218ms (Views: 188.1ms | ActiveRecord: 1.0ms)
Started GET "/" for ::1 at 2016-07-16 19:06:56 +0800
Processing by PagesController#index as HTML
Category Load (0.5ms) SELECT "categories".* FROM "categories"
Rendered pages/index.html.erb within layouts/application (2.0ms)
Completed 200 OK in 173ms (Views: 171.7ms | ActiveRecord: 0.5ms)
Started GET "/admin/posts" for ::1 at 2016-07-16 19:06:57 +0800
Processing by Admin::PostsController#index as HTML
Completed 401 Unauthorized in 23ms (ActiveRecord: 0.0ms)
Started GET "/users/sign_in" for ::1 at 2016-07-16 19:06:57 +0800
Processing by Devise::SessionsController#new as HTML
Rendered devise/shared/_links.html.erb (10.0ms)
Rendered devise/sessions/new.html.erb within layouts/application (540.5ms)
Completed 200 OK in 769ms (Views: 755.1ms | ActiveRecord: 1.0ms)
Started GET "/users/sign_up" for ::1 at 2016-07-16 19:07:02 +0800
Processing by Devise::RegistrationsController#new as HTML
Rendered devise/shared/_links.html.erb (6.0ms)
Rendered devise/registrations/new.html.erb within layouts/application (60.1ms)
Completed 200 OK in 249ms (Views: 248.4ms | ActiveRecord: 0.0ms)
Started POST "/users" for ::1 at 2016-07-16 19:07:25 +0800
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"DGphfyol+2QRH/uBSMOcFeE4p6CooLOZXOfiMKltVZ+9Sn7fV8ZUEwChBWr61vu1pPT7E/xF35mENtm7HP3xgw==", "user"=>{"email"=>"rey@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
 (0.0ms) begin transaction
User Exists (1.0ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'rey@gmail.com' LIMIT 1
SQL (1.0ms) INSERT INTO "users" ("email", "encrypted_password", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["email", "rey@gmail.com"], ["encrypted_password", "$2a$11$rAlNR10Tie0WDat6GamZ7encfHVH/3q2yPrkHr1SaNK5oV.Js5Eqi"], ["created_at", "2016-07-16 11:07:25.537848"], ["updated_at", "2016-07-16 11:07:25.537848"]]
 (143.1ms) commit transaction
 (0.5ms) begin transaction
SQL (21.7ms) UPDATE "users" SET "last_sign_in_at" = ?, "current_sign_in_at" = ?, "last_sign_in_ip" = ?, "current_sign_in_ip" = ?, "sign_in_count" = ?, "updated_at" = ? WHERE "users"."id" = ? [["last_sign_in_at", "2016-07-16 11:07:25.695990"], ["current_sign_in_at", "2016-07-16 11:07:25.695990"], ["last_sign_in_ip", "::1"], ["current_sign_in_ip", "::1"], ["sign_in_count", 1], ["updated_at", "2016-07-16 11:07:25.699011"], ["id", 1]]
 (123.8ms) commit transaction
Redirected to http://localhost:3000/admin/posts
Completed 302 Found in 907ms (ActiveRecord: 291.1ms)
Started GET "/admin/posts" for ::1 at 2016-07-16 19:07:26 +0800
Processing by Admin::PostsController#index as HTML
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Post Load (0.0ms) SELECT "posts".* FROM "posts"
Rendered admin/posts/index.html.erb within layouts/application (4.0ms)
Completed 200 OK in 165ms (Views: 161.0ms | ActiveRecord: 0.5ms)
Started GET "/admin/posts/new" for ::1 at 2016-07-16 19:07:28 +0800
Processing by Admin::PostsController#new as HTML
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Category Load (0.0ms) SELECT "categories".* FROM "categories"
Rendered admin/posts/_form.html.erb (109.2ms)
Rendered admin/posts/new.html.erb within layouts/application (133.7ms)
Completed 200 OK in 291ms (Views: 280.0ms | ActiveRecord: 0.5ms)
Started POST "/admin/posts" for ::1 at 2016-07-16 19:07:50 +0800
Processing by Admin::PostsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"dczRm70XEefe8WHd4Irozm/Y8cn7iQqc6MaIiac4sb3E7M47wPS+kM9PnzZSn49uKhSteq9sZpwwF7MCEqgVoQ==", "post"=>{"title"=>"Moo", "category_id"=>"", "published_at(1i)"=>"2016", "published_at(2i)"=>"7", "published_at(3i)"=>"16", "content"=>"cow", "is_published"=>"1"}, "commit"=>"Create Post"}
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
 (0.5ms) begin transaction
Post Exists (0.5ms) SELECT 1 AS one FROM "posts" WHERE "posts"."title" = 'Moo' LIMIT 1
Post Exists (0.5ms) SELECT 1 AS one FROM "posts" WHERE "posts"."content" = 'cow' LIMIT 1
SQL (1.0ms) INSERT INTO "posts" ("title", "content", "is_published", "published_at", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["title", "Moo"], ["content", "cow"], ["is_published", "t"], ["published_at", "2016-07-16"], ["created_at", "2016-07-16 11:07:50.525915"], ["updated_at", "2016-07-16 11:07:50.525915"]]
 (106.8ms) commit transaction
Redirected to http://localhost:3000/posts/1
Completed 302 Found in 177ms (ActiveRecord: 109.8ms)
Started GET "/posts/1" for ::1 at 2016-07-16 19:07:50 +0800
Processing by PostsController#show as HTML
Parameters: {"id"=>"1"}
Post Load (0.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1]]
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Rendered posts/show.html.erb within layouts/application (4.0ms)
Completed 200 OK in 184ms (Views: 169.7ms | ActiveRecord: 0.0ms)
I"/C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/javascripts/application.js?type=application/javascript&id=5fc51d5d88e847935bf736ae2db1db42cf52bd8b8679105e131f50e52f7026db:ET
\ No newline at end of file
[o:Set:
@hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"0processors:type=text/css&file_type=text/css;TTI"}file-digest:///C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"mfile-digest:///C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets;TT
\ No newline at end of file
I"/C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery.js?type=application/javascript&pipeline=self&id=a5c87903a2374d47dd729f064533f76fef2a4a680ed13f94a18b796345e77b18:ET
\ No newline at end of file
I"/C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/javascripts/application.js?type=application/javascript&pipeline=debug&id=2c4500260a7811785e765aa4582f3155205c228f2f183aa5d4a0107cf49fb455:ET
\ No newline at end of file
I"/C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets/application.css?type=text/css&pipeline=debug&id=44da1a88abb05b0541938ffb3cd5c2888d2633d903b2d3c8c8468ac2e1c7e042:ET
\ No newline at end of file
I"/C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/turbolinks-source-5.0.0/lib/assets/javascripts/turbolinks.js?type=application/javascript&pipeline=self&id=f9eef14140bc22e5b13af7388874f3d501b9e37816a54fdf2725bf28c03d6e32:ET
\ No newline at end of file
[o:Set:
@hash{
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery_ujs.js;TT
\ No newline at end of file
I"/C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=65413b5d48485963a1f1f7e428d10c2bbd1960aa72001e6e0ea2c78433925dd8:ET
\ No newline at end of file
I"/C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery_ujs.js?type=application/javascript&pipeline=self&id=53a67bbc04c64d05c8215ebc9312e7605bb07f18e135edf19cb7b0a80fe82425:ET
\ No newline at end of file
[o:Set:
@hash{
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/turbolinks-source-5.0.0/lib/assets/javascripts/turbolinks.js;TT
\ No newline at end of file
[o:Set:
@hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"?processors:type=text/css&file_type=text/css&pipeline=debug;TTI"}file-digest:///C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"mfile-digest:///C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets;TT
\ No newline at end of file
I"/C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=9f452fc9a868b0fd7e1537ef06f5e15589e210d2a29691fafdd7f9a35a42dc88:ET
\ No newline at end of file
I"/C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets/application.css?type=text/css&id=18d514a8ed8e12823e6ea7a1385ee2e97ed1afa17e8118c37887017c5b299a46:ET
\ No newline at end of file
[o:Set:
@hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"}file-digest:///C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets/application.css;TTI"mfile-digest:///C:/Users/Koki%20Mamards/Desktop/submissions/144666/blog%20gonzales/app/assets/stylesheets;TT
\ No newline at end of file
[o:Set:
@hash{
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///C:/Bitnami/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery.js;TT
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment