Started voucher system

This commit is contained in:
spengreb 2019-09-27 19:03:44 +02:00
parent ebc9f93b2a
commit 51c0c9561a
11 changed files with 1126 additions and 13 deletions

View file

@ -18,3 +18,26 @@ Run
# TO DO # TO DO
- Email verification on sign up - Email verification on sign up
- Comments to articles - Comments to articles
# vouching
Player submits their name and person they want to vouch
Voucher is checked to be already in the whitelist
and
if the vouchee is in the mojang database
and
not already in the whitelist
and
not already vouched for
and
voucher has not already tried to vouch for this person
and
voucher is not vouching for himself
| id | voucher | vouchee | accepted | |
|---|---|---|---|---|
| 0 | promostarr | promostarr | 1 | |
| 1 | promostarr | goblin | | |
| 2 | goblin | chaosg0d | | |

View file

@ -0,0 +1,56 @@
class VouchersController < ApplicationController
before_action :set_voucher, only: [:show, :update, :destroy]
skip_before_action :authorize_request, only: [:index, :show, :create]
# GET /vouchers
def index
@vouchers = Voucher.all
render json: @vouchers
end
# GET /vouchers/1
def show
render json: @voucher
end
# POST /vouchers
def create
# Logic for creating a voucher
params[:voucher]
if Voucher.exists?(vouchee: params[:voucher])
@voucher = Voucher.new(voucher_params)
end
if @voucher.save
render json: @voucher, status: :created, location: @voucher
else
render json: @voucher.errors, status: :unprocessable_entity
end
end
# PATCH/PUT /vouchers/1
def update
if @voucher.update(voucher_params)
render json: @voucher
else
render json: @voucher.errors, status: :unprocessable_entity
end
end
# DELETE /vouchers/1
def destroy
@voucher.destroy
end
private
# Use callbacks to share common setup or constraints between actions.
def set_voucher
@voucher = Voucher.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def voucher_params
params.permit(:voucher, :vouchee, :accepted)
end
end

5
app/models/voucher.rb Normal file
View file

@ -0,0 +1,5 @@
class Voucher < ApplicationRecord
validates_presence_of :voucher, :vouchee
validates_uniqueness_of :vouchee
end

View file

@ -1,5 +1,6 @@
Rails.application.routes.draw do Rails.application.routes.draw do
resources :user_profiles resources :vouchers
resources :comments resources :comments
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
@ -14,6 +15,13 @@ Rails.application.routes.draw do
end end
resources :users resources :users
post 'login', to: 'authentication#authenticate'
post 'register', to: 'users#create' # ** TO DO ** #
# Pls activate again when you've made this more secure
# I dont think its a good idea to send passwords over plaintext
# resources :user_profiles
# post 'login', to: 'authentication#authenticate'
# post 'register', to: 'users#create'
# ** TODO ** #
end end

View file

@ -0,0 +1,11 @@
class CreateVouchers < ActiveRecord::Migration[6.0]
def change
create_table :vouchers do |t|
t.string :voucher
t.string :vouchee
t.boolean :accepted
t.timestamps
end
end
end

View file

@ -2,17 +2,17 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # This file is the source Rails uses to define your schema when running `rails
# database schema. If you need to create the application database on another # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# system, you should be using db:schema:load, not running all the migrations # be faster and is potentially less error prone than running all of your
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # migrations from scratch. Old migrations may fail to apply correctly if those
# you'll amass, the slower it'll run and the greater likelihood for issues). # migrations use external dependencies or application code.
# #
# 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: 2019_02_14_142704) do ActiveRecord::Schema.define(version: 2019_09_27_154659) do
create_table "articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "articles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "title" t.string "title"
t.text "post" t.text "post"
t.bigint "user_id" t.bigint "user_id"
@ -21,7 +21,7 @@ ActiveRecord::Schema.define(version: 2019_02_14_142704) do
t.index ["user_id"], name: "index_articles_on_user_id" t.index ["user_id"], name: "index_articles_on_user_id"
end end
create_table "comments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "comments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.text "content" t.text "content"
t.bigint "article_id" t.bigint "article_id"
t.bigint "user_id" t.bigint "user_id"
@ -31,7 +31,7 @@ ActiveRecord::Schema.define(version: 2019_02_14_142704) do
t.index ["user_id"], name: "index_comments_on_user_id" t.index ["user_id"], name: "index_comments_on_user_id"
end end
create_table "user_profiles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "user_profiles", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "avatar" t.string "avatar"
t.string "tagline" t.string "tagline"
t.date "dob" t.date "dob"
@ -42,7 +42,7 @@ ActiveRecord::Schema.define(version: 2019_02_14_142704) do
t.index ["user_id"], name: "index_user_profiles_on_user_id" t.index ["user_id"], name: "index_user_profiles_on_user_id"
end end
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "name" t.string "name"
t.string "email" t.string "email"
t.string "password_digest" t.string "password_digest"
@ -50,6 +50,14 @@ ActiveRecord::Schema.define(version: 2019_02_14_142704) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "vouchers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "voucher"
t.string "vouchee"
t.boolean "accepted"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
add_foreign_key "articles", "users" add_foreign_key "articles", "users"
add_foreign_key "comments", "articles" add_foreign_key "comments", "articles"
add_foreign_key "comments", "users" add_foreign_key "comments", "users"

View file

@ -540,3 +540,831 @@ Processing by Rails::WelcomeController#index as HTML
Completed 200 OK in 18ms (Views: 15.4ms | ActiveRecord: 0.0ms | Allocations: 3069) Completed 200 OK in 18ms (Views: 15.4ms | ActiveRecord: 0.0ms | Allocations: 3069)
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.1ms) CREATE DATABASE `vereto-api-dev` DEFAULT CHARACTER SET `utf8mb4`
 (0.1ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.1ms) CREATE DATABASE `vereto-api-test` DEFAULT CHARACTER SET `utf8mb4`
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (18.3ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL PRIMARY KEY)
 (15.9ms) CREATE TABLE `ar_internal_metadata` (`key` varchar(255) NOT NULL PRIMARY KEY, `value` varchar(255), `created_at` datetime(6) NOT NULL, `updated_at` datetime(6) NOT NULL)
 (0.1ms) SELECT GET_LOCK('1433072424460498080', 0)
 (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Migrating to CreateUsers (20180216131546)
 (19.4ms) CREATE TABLE `users` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255), `email` varchar(255), `password_digest` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
 (0.1ms) BEGIN
primary::SchemaMigration Create (0.2ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20180216131546')
 (2.2ms) COMMIT
Migrating to CreateArticles (20180219100642)
 (18.1ms) CREATE TABLE `articles` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(255), `post` text, `user_id` bigint, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_articles_on_user_id` (`user_id`), CONSTRAINT `fk_rails_3d31dad1cc`
FOREIGN KEY (`user_id`)
REFERENCES `users` (`id`)
) ENGINE=InnoDB
 (0.1ms) BEGIN
primary::SchemaMigration Create (0.2ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20180219100642')
 (5.1ms) COMMIT
Migrating to CreateComments (20180222154430)
 (21.5ms) CREATE TABLE `comments` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `content` text, `article_id` bigint, `user_id` bigint, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_comments_on_article_id` (`article_id`), INDEX `index_comments_on_user_id` (`user_id`), CONSTRAINT `fk_rails_3bf61a60d3`
FOREIGN KEY (`article_id`)
REFERENCES `articles` (`id`)
, CONSTRAINT `fk_rails_03de2dc08c`
FOREIGN KEY (`user_id`)
REFERENCES `users` (`id`)
) ENGINE=InnoDB
 (0.1ms) BEGIN
primary::SchemaMigration Create (0.2ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20180222154430')
 (2.4ms) COMMIT
Migrating to CreateUserProfiles (20190214142704)
 (30.6ms) CREATE TABLE `user_profiles` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `avatar` varchar(255), `tagline` varchar(255), `dob` date, `role` varchar(255), `user_id` bigint, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, INDEX `index_user_profiles_on_user_id` (`user_id`), CONSTRAINT `fk_rails_87a6352e58`
FOREIGN KEY (`user_id`)
REFERENCES `users` (`id`)
)
 (0.1ms) BEGIN
primary::SchemaMigration Create (0.2ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20190214142704')
 (3.0ms) COMMIT
ActiveRecord::InternalMetadata Load (0.3ms) SELECT `ar_internal_metadata`.* FROM `ar_internal_metadata` WHERE `ar_internal_metadata`.`key` = 'environment' LIMIT 1
 (0.1ms) BEGIN
ActiveRecord::InternalMetadata Create (0.2ms) INSERT INTO `ar_internal_metadata` (`key`, `value`, `created_at`, `updated_at`) VALUES ('environment', 'development', '2019-09-27 10:43:00.227462', '2019-09-27 10:43:00.227462')
 (2.2ms) COMMIT
 (0.1ms) SELECT RELEASE_LOCK('1433072424460498080')
 (0.1ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.1ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Started POST "/register" for ::1 at 2019-09-27 12:43:26 +0200
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Processing by UsersController#create as HTML
Parameters: {"name"=>"Promostarr", "email"=>"conor@manusit.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "user"=>{"name"=>"Promostarr", "email"=>"conor@manusit.com"}}
Unpermitted parameter: :user
DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. To continue case sensitive comparison on the :email attribute in User model, pass `case_sensitive: true` option explicitly to the uniqueness validator. (called from create at /media/Linux-Shared/dev/gitlab.com/vereto-api/app/controllers/users_controller.rb:8)
 (0.1ms) BEGIN
↳ app/controllers/users_controller.rb:8:in `create'
User Exists? (0.2ms) SELECT 1 AS one FROM `users` WHERE `users`.`email` = BINARY 'conor@manusit.com' LIMIT 1
↳ app/controllers/users_controller.rb:8:in `create'
User Create (0.3ms) INSERT INTO `users` (`name`, `email`, `password_digest`, `created_at`, `updated_at`) VALUES ('Promostarr', 'conor@manusit.com', '$2a$12$cS3om37.pKkcdxd9HpTdj.E37z0idpqhMpYg16H9XRjd6K6DN4eAW', '2019-09-27 10:43:26', '2019-09-27 10:43:26')
↳ app/controllers/users_controller.rb:8:in `create'
 (3.3ms) COMMIT
↳ app/controllers/users_controller.rb:8:in `create'
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1
↳ app/auth/authenticate_user.rb:17:in `user'
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/auth/authenticate_user.rb:17:in `user'
Completed 201 Created in 585ms (Views: 0.2ms | ActiveRecord: 5.4ms | Allocations: 10264)
Started POST "/login" for ::1 at 2019-09-27 12:43:34 +0200
Processing by AuthenticationController#authenticate as HTML
Parameters: {"email"=>"conor@manusit.com", "password"=>"[FILTERED]", "authentication"=>{"email"=>"conor@manusit.com", "password"=>"[FILTERED]"}}
Unpermitted parameter: :authentication
Unpermitted parameter: :authentication
User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1
↳ app/auth/authenticate_user.rb:17:in `user'
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/auth/authenticate_user.rb:17:in `user'
Unpermitted parameter: :authentication
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/controllers/authentication_controller.rb:7:in `authenticate'
Completed 200 OK in 405ms (Views: 0.3ms | ActiveRecord: 0.6ms | Allocations: 2117)
Started POST "/login" for 127.0.0.1 at 2019-09-27 13:21:56 +0200
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
Processing by AuthenticationController#authenticate as HTML
Parameters: {"email"=>"conor@manusit.com", "password"=>"[FILTERED]", "authentication"=>{"email"=>"conor@manusit.com", "password"=>"[FILTERED]"}}
Unpermitted parameter: :authentication
Unpermitted parameter: :authentication
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1
↳ app/auth/authenticate_user.rb:17:in `user'
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/auth/authenticate_user.rb:17:in `user'
Unpermitted parameter: :authentication
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/controllers/authentication_controller.rb:7:in `authenticate'
Completed 200 OK in 381ms (Views: 0.3ms | ActiveRecord: 0.3ms | Allocations: 2069)
Started POST "/login" for 127.0.0.1 at 2019-09-27 14:44:18 +0200
 (0.3ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
Processing by AuthenticationController#authenticate as HTML
Parameters: {"email"=>"conor@manusit.com", "password"=>"[FILTERED]", "authentication"=>{"email"=>"conor@manusit.com", "password"=>"[FILTERED]"}}
Unpermitted parameter: :authentication
Unpermitted parameter: :authentication
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1
↳ app/auth/authenticate_user.rb:17:in `user'
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/auth/authenticate_user.rb:17:in `user'
Unpermitted parameter: :authentication
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/controllers/authentication_controller.rb:7:in `authenticate'
Completed 200 OK in 418ms (Views: 0.3ms | ActiveRecord: 0.5ms | Allocations: 2058)
Started POST "/login" for 127.0.0.1 at 2019-09-27 15:55:35 +0200
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
Processing by AuthenticationController#authenticate as HTML
Parameters: {"email"=>"conor@manusit.com", "password"=>"[FILTERED]", "authentication"=>{"email"=>"conor@manusit.com", "password"=>"[FILTERED]"}}
Unpermitted parameter: :authentication
Unpermitted parameter: :authentication
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1
↳ app/auth/authenticate_user.rb:17:in `user'
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/auth/authenticate_user.rb:17:in `user'
Unpermitted parameter: :authentication
CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1 [["email", "conor@manusit.com"], ["LIMIT", 1]]
↳ app/controllers/authentication_controller.rb:7:in `authenticate'
Completed 200 OK in 386ms (Views: 0.3ms | ActiveRecord: 0.4ms | Allocations: 2066)
 (0.5ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.1ms) SELECT GET_LOCK('1433072424460498080', 0)
 (0.1ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Migrating to CreateVouchers (20190927154659)
 (19.2ms) CREATE TABLE `vouchers` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `voucher` varchar(255), `vouchee` varchar(255), `accepted` tinyint(1), `created_at` datetime(6) NOT NULL, `updated_at` datetime(6) NOT NULL)
 (0.1ms) BEGIN
primary::SchemaMigration Create (0.2ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20190927154659')
 (2.0ms) COMMIT
ActiveRecord::InternalMetadata Load (0.2ms) SELECT `ar_internal_metadata`.* FROM `ar_internal_metadata` WHERE `ar_internal_metadata`.`key` = 'environment' LIMIT 1
 (0.1ms) SELECT RELEASE_LOCK('1433072424460498080')
 (0.1ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.1ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Started GET "/" for ::1 at 2019-09-27 17:47:21 +0200
 (0.4ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Processing by Rails::WelcomeController#index as */*
Rendering /usr/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb
Rendered /usr/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb (Duration: 4.0ms | Allocations: 559)
Completed 200 OK in 8ms (Views: 6.2ms | ActiveRecord: 0.0ms | Allocations: 3047)
DEPRECATION WARNING: Using `bin/rake routes` is deprecated and will be removed in Rails 6.1. Use `bin/rails routes` instead.
(called from load at /usr/bin/rake:23)
Started GET "/vouchers" for ::1 at 2019-09-27 17:47:53 +0200
 (0.3ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Processing by VouchersController#index as */*
Completed 422 Unprocessable Entity in 23ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 819)
Started GET "/" for ::1 at 2019-09-27 17:51:11 +0200
Processing by Rails::WelcomeController#index as */*
Rendering /usr/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb
Rendered /usr/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb (Duration: 4.6ms | Allocations: 396)
Completed 200 OK in 7ms (Views: 5.9ms | ActiveRecord: 0.0ms | Allocations: 2019)
Started GET "/articles" for ::1 at 2019-09-27 17:51:18 +0200
Processing by V1::ArticlesController#index as */*
 (0.2ms) SELECT COUNT(*) FROM `articles`
↳ app/controllers/v1/articles_controller.rb:10:in `index'
Article Load (0.1ms) SELECT `articles`.* FROM `articles` ORDER BY `articles`.`created_at` DESC LIMIT 10 OFFSET 0
↳ app/controllers/v1/articles_controller.rb:18:in `index'
Completed 200 OK in 17ms (Views: 0.2ms | ActiveRecord: 0.7ms | Allocations: 4509)
Started POST "/login?email=conor@manusit.com&password=[FILTERED]" for ::1 at 2019-09-27 17:52:35 +0200
Processing by AuthenticationController#authenticate as */*
Parameters: {"email"=>"conor@manusit.com", "password"=>"[FILTERED]"}
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'conor@manusit.com' LIMIT 1
↳ app/auth/authenticate_user.rb:17:in `user'
Completed 401 Unauthorized in 240ms (Views: 0.2ms | ActiveRecord: 1.5ms | Allocations: 7762)
Started GET "/users" for ::1 at 2019-09-27 17:55:29 +0200
 (0.4ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
AbstractController::ActionNotFound (The action 'index' could not be found for UsersController):
actionpack (6.0.0) lib/abstract_controller/base.rb:131:in `process'
actionpack (6.0.0) lib/action_controller/metal.rb:191:in `dispatch'
actionpack (6.0.0) lib/action_controller/metal.rb:252:in `dispatch'
actionpack (6.0.0) lib/action_dispatch/routing/route_set.rb:51:in `dispatch'
actionpack (6.0.0) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.0.0) lib/action_dispatch/journey/router.rb:49:in `block in serve'
actionpack (6.0.0) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.0.0) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.0.0) lib/action_dispatch/routing/route_set.rb:837:in `call'
rack (2.0.7) lib/rack/etag.rb:25:in `call'
rack (2.0.7) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.7) lib/rack/head.rb:12:in `call'
activerecord (6.0.0) lib/active_record/migration.rb:567:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.0.0) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (6.0.0) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.7) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
rack-cors (1.0.3) lib/rack/cors.rb:95:in `call'
railties (6.0.0) lib/rails/engine.rb:526:in `call'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Started GET "/users/promostarr" for ::1 at 2019-09-27 17:56:19 +0200
Processing by UsersController#show as */*
Parameters: {"id"=>"promostarr"}
Completed 422 Unprocessable Entity in 11ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 2359)
Started GET "/" for 127.0.0.1 at 2019-09-27 17:59:54 +0200
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.4ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Processing by Rails::WelcomeController#index as HTML
Rendering /usr/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb
Rendered /usr/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/templates/rails/welcome/index.html.erb (Duration: 4.3ms | Allocations: 396)
Completed 200 OK in 7ms (Views: 5.9ms | ActiveRecord: 0.0ms | Allocations: 1981)
Started GET "/favicon.ico" for 127.0.0.1 at 2019-09-27 17:59:54 +0200
ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
actionpack (6.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.7) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
rack-cors (1.0.3) lib/rack/cors.rb:95:in `call'
railties (6.0.0) lib/rails/engine.rb:526:in `call'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Started POST "/login" for 127.0.0.1 at 2019-09-27 18:00:06 +0200
ActionController::RoutingError (No route matches [POST] "/login"):
actionpack (6.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.7) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
rack-cors (1.0.3) lib/rack/cors.rb:95:in `call'
railties (6.0.0) lib/rails/engine.rb:526:in `call'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Started POST "/login" for 127.0.0.1 at 2019-09-27 18:00:22 +0200
ActionController::RoutingError (No route matches [POST] "/login"):
actionpack (6.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.7) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
rack-cors (1.0.3) lib/rack/cors.rb:95:in `call'
railties (6.0.0) lib/rails/engine.rb:526:in `call'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Started GET "/vouchers" for ::1 at 2019-09-27 18:08:59 +0200
 (0.3ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
Processing by VouchersController#index as */*
Voucher Load (0.3ms) SELECT `vouchers`.* FROM `vouchers`
↳ app/controllers/vouchers_controller.rb:9:in `index'
Completed 200 OK in 5ms (Views: 2.1ms | ActiveRecord: 0.8ms | Allocations: 2201)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:09:37 +0200
Processing by VouchersController#create as */*
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 422 Unprocessable Entity in 10ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 2294)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:10:14 +0200
Processing by VouchersController#create as */*
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms | Allocations: 596)
NoMethodError (undefined method `permit' for "promostarr":String):
app/controllers/vouchers_controller.rb:50:in `voucher_params'
app/controllers/vouchers_controller.rb:19:in `create'
Started POST "/login" for 127.0.0.1 at 2019-09-27 18:13:11 +0200
ActionController::RoutingError (No route matches [POST] "/login"):
actionpack (6.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.0) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.0) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.7) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.0) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.0.7) lib/rack/sendfile.rb:111:in `call'
actionpack (6.0.0) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
rack-cors (1.0.3) lib/rack/cors.rb:95:in `call'
railties (6.0.0) lib/rails/engine.rb:526:in `call'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:16:29 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms | Allocations: 118)
NoMethodError (undefined method `permit' for "promostarr":String):
app/controllers/vouchers_controller.rb:50:in `voucher_params'
app/controllers/vouchers_controller.rb:19:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:21:56 +0200
 (0.2ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
 (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
 (0.1ms) BEGIN
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Create (0.2ms) INSERT INTO `vouchers` (`voucher`, `vouchee`, `accepted`, `created_at`, `updated_at`) VALUES ('promostarr', 'promostarr', TRUE, '2019-09-27 16:21:56.250842', '2019-09-27 16:21:56.250842')
↳ app/controllers/vouchers_controller.rb:21:in `create'
 (33.7ms) COMMIT
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 201 Created in 42ms (Views: 0.8ms | ActiveRecord: 34.8ms | Allocations: 6974)
Started GET "/vouchers" for ::1 at 2019-09-27 18:22:14 +0200
Processing by VouchersController#index as HTML
Parameters: {"voucher"=>{}}
Voucher Load (0.3ms) SELECT `vouchers`.* FROM `vouchers`
↳ app/controllers/vouchers_controller.rb:9:in `index'
Completed 200 OK in 4ms (Views: 3.2ms | ActiveRecord: 0.3ms | Allocations: 995)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:24:08 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 144)
Started GET "/vouchers" for ::1 at 2019-09-27 18:24:16 +0200
Processing by VouchersController#index as HTML
Parameters: {"voucher"=>{}}
Voucher Load (0.3ms) SELECT `vouchers`.* FROM `vouchers`
↳ app/controllers/vouchers_controller.rb:9:in `index'
Completed 200 OK in 5ms (Views: 4.4ms | ActiveRecord: 1.5ms | Allocations: 4261)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:24:29 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 243)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:24:35 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms | Allocations: 226)
NoMethodError (undefined method `voucher' for #<ActionController::Parameters:0x00007fb7f002e720>):
app/controllers/vouchers_controller.rb:21:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:24:40 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 6ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 253)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:24:56 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 226)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:25:03 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 243)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:26:32 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 156)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:27:37 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 500 Internal Server Error in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 242)
AbstractController::DoubleRenderError (Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".):
app/controllers/vouchers_controller.rb:21:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:29:32 +0200
SyntaxError (/media/Linux-Shared/dev/gitlab.com/vereto-api/app/controllers/vouchers_controller.rb:55: syntax error, unexpected end-of-input, expecting end):
app/controllers/vouchers_controller.rb:55: syntax error, unexpected end-of-input, expecting end
app/controllers/vouchers_controller.rb:55: syntax error, unexpected end-of-input, expecting end
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:29:45 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 146)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr&accepted=1" for ::1 at 2019-09-27 18:30:16 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr", "accepted"=>"1"}
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms | Allocations: 654)
NoMethodError (undefined method `findby' for #<Class:0x0000559a956481f8>):
app/controllers/vouchers_controller.rb:21:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:32:38 +0200
SyntaxError (/media/Linux-Shared/dev/gitlab.com/vereto-api/app/models/voucher.rb:3: syntax error, unexpected ':', expecting end
...alidates_presence_of :voucher :vouchee
... ^):
app/models/voucher.rb:3: syntax error, unexpected ':', expecting end
app/models/voucher.rb:3: syntax error, unexpected ':', expecting end
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:32:57 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms | Allocations: 625)
NoMethodError (undefined method `findby' for #<Class:0x00007fb7e42a4f88>):
app/controllers/vouchers_controller.rb:21:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:33:05 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 153)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:33:18 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 154)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:34:18 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Voucher Load (0.3ms) SELECT `vouchers`.* FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 7ms (Views: 0.4ms | ActiveRecord: 1.1ms | Allocations: 5080)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:34:33 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Voucher Load (0.3ms) SELECT `vouchers`.* FROM `vouchers` WHERE `vouchers`.`voucher` = 'leoroy' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 3ms (Views: 0.2ms | ActiveRecord: 0.9ms | Allocations: 1212)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:36:11 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Voucher Load (0.5ms) SELECT `vouchers`.* FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
CACHE Voucher Load (0.0ms) SELECT `vouchers`.* FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1 [["voucher", "promostarr"], ["LIMIT", 1]]
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 10ms (Views: 0.1ms | ActiveRecord: 1.5ms | Allocations: 5018)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:36:42 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Voucher Load (0.3ms) SELECT `vouchers`.* FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
CACHE Voucher Load (0.0ms) SELECT `vouchers`.* FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1 [["voucher", "promostarr"], ["LIMIT", 1]]
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 500 Internal Server Error in 52ms (ActiveRecord: 1.9ms | Allocations: 32016)
NameError (undefined local variable or method `null' for #<VouchersController:0x00007fb7e00699c0>):
app/controllers/vouchers_controller.rb:22:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:38:47 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 4ms (Views: 0.2ms | ActiveRecord: 0.7ms | Allocations: 1212)
Started POST "/vouchers?voucher=promostarr&vouchee=promostarr" for ::1 at 2019-09-27 18:39:18 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"promostarr"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
CACHE Voucher Exists? (0.0ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.6ms | Allocations: 1726)
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:39:45 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.4ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 0.6ms | Allocations: 1324)
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:39:51 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 0.9ms | Allocations: 1806)
Started GET "/vouchers" for ::1 at 2019-09-27 18:40:35 +0200
Processing by VouchersController#index as HTML
Parameters: {"voucher"=>{}}
Voucher Load (0.2ms) SELECT `vouchers`.* FROM `vouchers`
↳ app/controllers/vouchers_controller.rb:9:in `index'
Completed 200 OK in 6ms (Views: 4.9ms | ActiveRecord: 1.2ms | Allocations: 4335)
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:40:40 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Voucher Exists? (0.1ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 4ms (Views: 0.1ms | ActiveRecord: 0.6ms | Allocations: 1967)
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:41:51 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Voucher Exists? (0.1ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:22:in `create'
Completed 200 OK in 5ms (Views: 0.1ms | ActiveRecord: 1.0ms | Allocations: 2417)
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:42:43 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 41ms (ActiveRecord: 1.6ms | Allocations: 33728)
NameError (undefined local variable or method `output' for #<VouchersController:0x00007fb7e407f320>):
app/controllers/vouchers_controller.rb:27:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:42:50 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.1ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.1ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
 (0.1ms) BEGIN
↳ app/controllers/vouchers_controller.rb:27:in `create'
Voucher Create (0.2ms) INSERT INTO `vouchers` (`voucher`, `vouchee`, `created_at`, `updated_at`) VALUES ('promostarr', 'goblin', '2019-09-27 16:42:50.461923', '2019-09-27 16:42:50.461923')
↳ app/controllers/vouchers_controller.rb:27:in `create'
 (5.4ms) COMMIT
↳ app/controllers/vouchers_controller.rb:27:in `create'
Completed 201 Created in 16ms (Views: 0.5ms | ActiveRecord: 7.0ms | Allocations: 8166)
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:42:53 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.5ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.4ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.4ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 6ms (ActiveRecord: 1.2ms | Allocations: 1964)
NoMethodError (undefined method `errors=' for nil:NilClass):
app/controllers/vouchers_controller.rb:24:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:43:09 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 4ms (ActiveRecord: 1.2ms | Allocations: 2435)
NoMethodError (undefined method `save' for nil:NilClass):
app/controllers/vouchers_controller.rb:25:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:46:57 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`voucher` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.8ms | Allocations: 1958)
NoMethodError (undefined method `save' for nil:NilClass):
app/controllers/vouchers_controller.rb:25:in `create'
Started POST "/vouchers?voucher=promostarr&vouchee=goblin" for ::1 at 2019-09-27 18:54:14 +0200
 (0.3ms) SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"promostarr", "vouchee"=>"goblin"}
DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. To continue case sensitive comparison on the :vouchee attribute in Voucher model, pass `case_sensitive: true` option explicitly to the uniqueness validator. (called from create at /media/Linux-Shared/dev/gitlab.com/vereto-api/app/controllers/vouchers_controller.rb:23)
 (0.2ms) BEGIN
↳ app/controllers/vouchers_controller.rb:23:in `create'
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = BINARY 'goblin' LIMIT 1
↳ app/controllers/vouchers_controller.rb:23:in `create'
 (0.1ms) ROLLBACK
↳ app/controllers/vouchers_controller.rb:23:in `create'
Completed 422 Unprocessable Entity in 752ms (Views: 0.1ms | ActiveRecord: 1.2ms | Allocations: 770760)
Started POST "/vouchers?voucher=goblin&vouchee=promostarr" for ::1 at 2019-09-27 18:54:45 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"goblin", "vouchee"=>"promostarr"}
DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. To continue case sensitive comparison on the :vouchee attribute in Voucher model, pass `case_sensitive: true` option explicitly to the uniqueness validator. (called from create at /media/Linux-Shared/dev/gitlab.com/vereto-api/app/controllers/vouchers_controller.rb:23)
 (0.1ms) BEGIN
↳ app/controllers/vouchers_controller.rb:23:in `create'
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = BINARY 'promostarr' LIMIT 1
↳ app/controllers/vouchers_controller.rb:23:in `create'
 (0.1ms) ROLLBACK
↳ app/controllers/vouchers_controller.rb:23:in `create'
Completed 422 Unprocessable Entity in 4ms (Views: 0.1ms | ActiveRecord: 0.6ms | Allocations: 3030)
Started POST "/vouchers?voucher=goblin&vouchee=chaosgod" for ::1 at 2019-09-27 18:54:51 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"goblin", "vouchee"=>"chaosgod"}
DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. To continue case sensitive comparison on the :vouchee attribute in Voucher model, pass `case_sensitive: true` option explicitly to the uniqueness validator. (called from create at /media/Linux-Shared/dev/gitlab.com/vereto-api/app/controllers/vouchers_controller.rb:23)
 (0.1ms) BEGIN
↳ app/controllers/vouchers_controller.rb:23:in `create'
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = BINARY 'chaosgod' LIMIT 1
↳ app/controllers/vouchers_controller.rb:23:in `create'
Voucher Create (0.3ms) INSERT INTO `vouchers` (`voucher`, `vouchee`, `created_at`, `updated_at`) VALUES ('goblin', 'chaosgod', '2019-09-27 16:54:51.775311', '2019-09-27 16:54:51.775311')
↳ app/controllers/vouchers_controller.rb:23:in `create'
 (5.7ms) COMMIT
↳ app/controllers/vouchers_controller.rb:23:in `create'
Completed 201 Created in 13ms (Views: 0.6ms | ActiveRecord: 6.3ms | Allocations: 3591)
Started POST "/vouchers?voucher=simon&vouchee=rus64" for ::1 at 2019-09-27 18:55:13 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"simon", "vouchee"=>"rus64"}
DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. To continue case sensitive comparison on the :vouchee attribute in Voucher model, pass `case_sensitive: true` option explicitly to the uniqueness validator. (called from create at /media/Linux-Shared/dev/gitlab.com/vereto-api/app/controllers/vouchers_controller.rb:23)
 (0.2ms) BEGIN
↳ app/controllers/vouchers_controller.rb:23:in `create'
Voucher Exists? (0.4ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = BINARY 'rus64' LIMIT 1
↳ app/controllers/vouchers_controller.rb:23:in `create'
Voucher Create (0.3ms) INSERT INTO `vouchers` (`voucher`, `vouchee`, `created_at`, `updated_at`) VALUES ('simon', 'rus64', '2019-09-27 16:55:13.042264', '2019-09-27 16:55:13.042264')
↳ app/controllers/vouchers_controller.rb:23:in `create'
 (4.2ms) COMMIT
↳ app/controllers/vouchers_controller.rb:23:in `create'
Completed 201 Created in 14ms (Views: 0.8ms | ActiveRecord: 5.1ms | Allocations: 3564)
Started POST "/vouchers?voucher=simon&vouchee=rus64" for ::1 at 2019-09-27 18:57:06 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"simon", "vouchee"=>"rus64"}
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'simon' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.7ms | Allocations: 1202)
NoMethodError (undefined method `save' for nil:NilClass):
app/controllers/vouchers_controller.rb:25:in `create'
Started POST "/vouchers?voucher=simon&vouchee=rus64" for ::1 at 2019-09-27 19:01:07 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"simon", "vouchee"=>"rus64"}
Voucher Exists? (0.3ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'simon' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.8ms | Allocations: 1201)
NoMethodError (undefined method `save=' for nil:NilClass):
app/controllers/vouchers_controller.rb:24:in `create'
Started POST "/vouchers?voucher=simon&vouchee=rus64" for ::1 at 2019-09-27 19:01:21 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"simon", "vouchee"=>"rus64"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'simon' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.7ms | Allocations: 1204)
NoMethodError (undefined method `save' for nil:NilClass):
app/controllers/vouchers_controller.rb:27:in `create'
Started POST "/vouchers?voucher=simon&vouchee=rus64" for ::1 at 2019-09-27 19:01:28 +0200
Processing by VouchersController#create as HTML
Parameters: {"voucher"=>"simon", "vouchee"=>"rus64"}
Voucher Exists? (0.2ms) SELECT 1 AS one FROM `vouchers` WHERE `vouchers`.`vouchee` = 'simon' LIMIT 1
↳ app/controllers/vouchers_controller.rb:21:in `create'
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.7ms | Allocations: 1203)
NoMethodError (undefined method `save' for "NOPE":String):
app/controllers/vouchers_controller.rb:27:in `create'

View file

@ -0,0 +1,129 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
#
# Also compared to earlier versions of this generator, there are no longer any
# expectations of assigns and templates rendered. These features have been
# removed from Rails core in Rails 5, but can be added back in via the
# `rails-controller-testing` gem.
RSpec.describe VouchersController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# Voucher. As you add validations to Voucher, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# VouchersController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "returns a success response" do
voucher = Voucher.create! valid_attributes
get :index, params: {}, session: valid_session
expect(response).to be_successful
end
end
describe "GET #show" do
it "returns a success response" do
voucher = Voucher.create! valid_attributes
get :show, params: {id: voucher.to_param}, session: valid_session
expect(response).to be_successful
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Voucher" do
expect {
post :create, params: {voucher: valid_attributes}, session: valid_session
}.to change(Voucher, :count).by(1)
end
it "renders a JSON response with the new voucher" do
post :create, params: {voucher: valid_attributes}, session: valid_session
expect(response).to have_http_status(:created)
expect(response.content_type).to eq('application/json')
expect(response.location).to eq(voucher_url(Voucher.last))
end
end
context "with invalid params" do
it "renders a JSON response with errors for the new voucher" do
post :create, params: {voucher: invalid_attributes}, session: valid_session
expect(response).to have_http_status(:unprocessable_entity)
expect(response.content_type).to eq('application/json')
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested voucher" do
voucher = Voucher.create! valid_attributes
put :update, params: {id: voucher.to_param, voucher: new_attributes}, session: valid_session
voucher.reload
skip("Add assertions for updated state")
end
it "renders a JSON response with the voucher" do
voucher = Voucher.create! valid_attributes
put :update, params: {id: voucher.to_param, voucher: valid_attributes}, session: valid_session
expect(response).to have_http_status(:ok)
expect(response.content_type).to eq('application/json')
end
end
context "with invalid params" do
it "renders a JSON response with errors for the voucher" do
voucher = Voucher.create! valid_attributes
put :update, params: {id: voucher.to_param, voucher: invalid_attributes}, session: valid_session
expect(response).to have_http_status(:unprocessable_entity)
expect(response.content_type).to eq('application/json')
end
end
end
describe "DELETE #destroy" do
it "destroys the requested voucher" do
voucher = Voucher.create! valid_attributes
expect {
delete :destroy, params: {id: voucher.to_param}, session: valid_session
}.to change(Voucher, :count).by(-1)
end
end
end

View file

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Voucher, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View file

@ -0,0 +1,10 @@
require 'rails_helper'
RSpec.describe "Vouchers", type: :request do
describe "GET /vouchers" do
it "works! (now write some real specs)" do
get vouchers_path
expect(response).to have_http_status(200)
end
end
end

View file

@ -0,0 +1,30 @@
require "rails_helper"
RSpec.describe VouchersController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/vouchers").to route_to("vouchers#index")
end
it "routes to #show" do
expect(:get => "/vouchers/1").to route_to("vouchers#show", :id => "1")
end
it "routes to #create" do
expect(:post => "/vouchers").to route_to("vouchers#create")
end
it "routes to #update via PUT" do
expect(:put => "/vouchers/1").to route_to("vouchers#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/vouchers/1").to route_to("vouchers#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/vouchers/1").to route_to("vouchers#destroy", :id => "1")
end
end
end