diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..fc8b2b3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,40 @@ +source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } + +ruby '2.6.0' + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 5.2.0' +# Use postgresql as the database for Active Record +gem 'pg', '>= 0.18', '< 2.0' +# Use Puma as the app server +gem 'puma', '~> 3.11' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.5' +# User Authentication +gem 'devise' +# API authentication +gem 'jwt' +# Pagination +gem 'kaminari' +# Reduces boot times through caching; required in config/boot.rb +gem 'bootsnap', '>= 1.1.0', require: false + +# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible +# gem 'rack-cors' + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] +end + +group :development do + gem 'listen', '>= 3.0.5', '< 3.2' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' +end + + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..56d9686 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,184 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.3) + actionpack (= 5.2.3) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.3) + actionpack (= 5.2.3) + actionview (= 5.2.3) + activejob (= 5.2.3) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.3) + actionview (= 5.2.3) + activesupport (= 5.2.3) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.3) + activesupport (= 5.2.3) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.3) + activesupport (= 5.2.3) + globalid (>= 0.3.6) + activemodel (5.2.3) + activesupport (= 5.2.3) + activerecord (5.2.3) + activemodel (= 5.2.3) + activesupport (= 5.2.3) + arel (>= 9.0) + activestorage (5.2.3) + actionpack (= 5.2.3) + activerecord (= 5.2.3) + marcel (~> 0.3.1) + activesupport (5.2.3) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + bcrypt (3.1.12) + bootsnap (1.4.4) + msgpack (~> 1.0) + builder (3.2.3) + byebug (10.0.2) + concurrent-ruby (1.1.5) + crass (1.0.4) + devise (4.6.2) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 6.0) + responders + warden (~> 1.2.3) + erubi (1.8.0) + ffi (1.10.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.5.1) + concurrent-ruby (~> 1.0) + jbuilder (2.8.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) + jwt (2.1.0) + kaminari (1.1.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) + actionview + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) + activerecord + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (0.9.2) + mimemagic (0.3.3) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + msgpack (1.2.10) + multi_json (1.13.1) + nio4r (2.3.1) + nokogiri (1.9.1) + mini_portile2 (~> 2.4.0) + orm_adapter (0.5.0) + pg (1.1.4) + puma (3.12.1) + rack (2.0.7) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.3) + actioncable (= 5.2.3) + actionmailer (= 5.2.3) + actionpack (= 5.2.3) + actionview (= 5.2.3) + activejob (= 5.2.3) + activemodel (= 5.2.3) + activerecord (= 5.2.3) + activestorage (= 5.2.3) + activesupport (= 5.2.3) + bundler (>= 1.3.0) + railties (= 5.2.3) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.2.3) + actionpack (= 5.2.3) + activesupport (= 5.2.3) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (12.3.2) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) + ruby_dep (1.3.1) + spring (2.0.2) + activesupport (>= 4.2) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + warden (1.2.8) + rack (>= 2.0.6) + websocket-driver (0.7.0) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + bootsnap (>= 1.1.0) + byebug + devise + jbuilder (~> 2.5) + jwt + kaminari + listen (>= 3.0.5, < 3.2) + pg (>= 0.18, < 2.0) + puma (~> 3.11) + rails (~> 5.2.0) + spring + spring-watcher-listen (~> 2.0.0) + tzinfo-data + +RUBY VERSION + ruby 2.6.0p0 + +BUNDLED WITH + 1.17.2 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..e85f913 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative 'config/application' + +Rails.application.load_tasks diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb new file mode 100644 index 0000000..d672697 --- /dev/null +++ b/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 0000000..0ff5442 --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..181d7ab --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,40 @@ +class ApplicationController < ActionController::API + include ActionController::HttpAuthentication::Token::ControllerMethods + + respond_to :json + + before_action :configure_permitted_parameters, if: :devise_controller? + before_action :authenticate_user, unless: :devise_controller? + + private + + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name]) + end + + def authenticate_user + if request.headers['Authorization'].present? + authenticate_or_request_with_http_token do |token| + begin + jwt_payload = JWT.decode(token, Rails.application.secrets.secret_key_base).first + + @current_user_id = jwt_payload['id'] + rescue JWT::ExpiredSignature, JWT::VerificationError, JWT::DecodeError + head :unauthorized + end + end + end + end + + def authenticate_user!(options = {}) + head :unauthorized unless signed_in? + end + + def current_user + @current_user ||= super || User.find(@current_user_id) + end + + def signed_in? + @current_user_id.present? + end +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..cfed661 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,11 @@ +class SessionsController < Devise::SessionsController + def create + user = User.find_by_email(sign_in_params[:email]) + + if user && user.valid_password?(sign_in_params[:password]) + @current_user = user + else + render json: { errors: { 'email or password' => ['is invalid'] } }, status: :unprocessable_entity + end + end +end \ No newline at end of file diff --git a/app/controllers/todo_list_items_controller.rb b/app/controllers/todo_list_items_controller.rb new file mode 100644 index 0000000..c2bda15 --- /dev/null +++ b/app/controllers/todo_list_items_controller.rb @@ -0,0 +1,61 @@ +class TodoListItemsController < ApplicationController + before_action :set_todo_list + before_action :set_todo_list_item, only: [:show, :update, :destroy, :complete] + + def index + @todo_list_items = @todo_list.todo_list_items + end + + def show + end + + def create + @todo_list_item = @todo_list.todo_list_items.new(todo_list_item_params) + + if @todo_list_item.save + render :show, status: :created + else + render json: @todo_list_item.errors, status: :unprocessable_entity + end + end + + def update + if @todo_list_item.update(todo_list_item_params) + render :show, status: :ok + else + render json: @todo_list_item.errors, status: :unprocessable_entity + end + end + + def destroy + @todo_list_item.destroy + end + + def complete + puts "=====" + puts @todo_list_item.to_json + puts "=====" + @todo_list_item.complete + end + + private + def set_todo_list_item + @todo_list_item = @todo_list.todo_list_items.find_by_id(params[:id]) + puts "=test===" + puts @todo_list_item.to_json + puts "====" + render json: { messge: "List item not found." }, status: 404 if @todo_list_item.blank? + end + + def set_todo_list + @todo_list = TodoList.find_by_id(params[:todo_list_id]) + puts "====" + puts @todo_list.to_json + puts "====" + render json: { messge: "List not found." }, status: 404 if @todo_list.blank? + end + + def todo_list_item_params + params.require(:todo_list_item).permit(:todo_list_id, :title) + end +end diff --git a/app/controllers/todo_lists_controller.rb b/app/controllers/todo_lists_controller.rb new file mode 100644 index 0000000..27bb319 --- /dev/null +++ b/app/controllers/todo_lists_controller.rb @@ -0,0 +1,46 @@ +class TodoListsController < ApplicationController + before_action :authenticate_user! + before_action :set_todo_list, only: [:show, :update, :destroy] + + def index + @page = params[:page] ? params[:page].to_i : 1 + @size = params[:size] ? params[:size].to_i : 10 + @todo_lists = current_user.todo_lists.includes(:todo_list_items).page(@page).per(@size) + end + + def show + end + + def create + @todo_list = current_user.todo_lists.new(todo_list_params) + + if @todo_list.save + @message = "Todo List saved successfully." + render :show, status: :created + else + render json: @todo_list.errors, status: :unprocessable_entity + end + end + + def update + if @todo_list.update(todo_list_params) + render :show, status: :ok + else + render json: @todo_list.errors, status: :unprocessable_entity + end + end + + def destroy + @todo_list.destroy + end + + private + def set_todo_list + @todo_list = current_user.todo_lists.find(params[:id]) + render json: { messge: "Record not found with ID" }, status: 404 if @todo_list.blank? + end + + def todo_list_params + params.require(:todo_list).permit(:title, :description) + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..6a51e39 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,5 @@ +class UsersController < ApplicationController + before_action :authenticate_user! + + def show;end +end \ No newline at end of file diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000..a009ace --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 0000000..286b223 --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..10a4cba --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/todo_list.rb b/app/models/todo_list.rb new file mode 100644 index 0000000..17874a0 --- /dev/null +++ b/app/models/todo_list.rb @@ -0,0 +1,27 @@ +class TodoList < ApplicationRecord + belongs_to :user + has_many :todo_list_items + + validates( + :title, + presence: true + ) + + validates_length_of( + :title, + maximum: 120, + allow_blank: true + ) + + validates_length_of( + :description, + maximum: 160, + allow_blank: true + ) + + def update_completed + puts "===todo ;oist==" + uncompleted_items = todo_list_items.select { |e| !e.completed? } + update(completed: true) if uncompleted_items.zero? + end +end diff --git a/app/models/todo_list_item.rb b/app/models/todo_list_item.rb new file mode 100644 index 0000000..31f4c9b --- /dev/null +++ b/app/models/todo_list_item.rb @@ -0,0 +1,14 @@ +class TodoListItem < ApplicationRecord + belongs_to :todo_list + + after_save :update_todo_list + + def complete + update(completed: true) + end + + private + def update_todo_list + todo_list.update_completed if completed && completed_changed? + end +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..9b3970d --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,25 @@ +class User < ApplicationRecord + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :validatable + + validates( + :first_name, + presence: true + ) + + validates( + :last_name, + presence: true + ) + + has_many :todo_lists + + def generate_jwt_token + JWT.encode( + { id: id, exp: 60.days.from_now.to_i }, + Rails.application.secrets.secret_key_base + ) + end +end diff --git a/app/views/devise/registrations/create.json.jbuilder b/app/views/devise/registrations/create.json.jbuilder new file mode 100644 index 0000000..df7714b --- /dev/null +++ b/app/views/devise/registrations/create.json.jbuilder @@ -0,0 +1,3 @@ +json.user do |json| + json.partial! 'users/user', user: current_user +end \ No newline at end of file diff --git a/app/views/devise/sessions/create.json.jbuilder b/app/views/devise/sessions/create.json.jbuilder new file mode 100644 index 0000000..df7714b --- /dev/null +++ b/app/views/devise/sessions/create.json.jbuilder @@ -0,0 +1,3 @@ +json.user do |json| + json.partial! 'users/user', user: current_user +end \ No newline at end of file diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000..cbd34d2 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/todo_list_items/_todo_list_item.json.jbuilder b/app/views/todo_list_items/_todo_list_item.json.jbuilder new file mode 100644 index 0000000..93fbff7 --- /dev/null +++ b/app/views/todo_list_items/_todo_list_item.json.jbuilder @@ -0,0 +1 @@ +json.extract! todo_list_item, :id, :todo_list_id, :title, :completed diff --git a/app/views/todo_list_items/complete.json.jbuilder b/app/views/todo_list_items/complete.json.jbuilder new file mode 100644 index 0000000..150219b --- /dev/null +++ b/app/views/todo_list_items/complete.json.jbuilder @@ -0,0 +1 @@ +json.partial! "todo_list_items/todo_list_item", todo_list_item: @todo_list_item diff --git a/app/views/todo_list_items/index.json.jbuilder b/app/views/todo_list_items/index.json.jbuilder new file mode 100644 index 0000000..61240f4 --- /dev/null +++ b/app/views/todo_list_items/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @todo_list_items, partial: 'todo_list_items/todo_list_item', as: :todo_list_item diff --git a/app/views/todo_list_items/show.json.jbuilder b/app/views/todo_list_items/show.json.jbuilder new file mode 100644 index 0000000..150219b --- /dev/null +++ b/app/views/todo_list_items/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "todo_list_items/todo_list_item", todo_list_item: @todo_list_item diff --git a/app/views/todo_lists/_todo_list.json.jbuilder b/app/views/todo_lists/_todo_list.json.jbuilder new file mode 100644 index 0000000..e153c56 --- /dev/null +++ b/app/views/todo_lists/_todo_list.json.jbuilder @@ -0,0 +1,9 @@ +json.id todo_list.id +json.title todo_list.title +json.description todo_list.description + +json.list_items todo_list.todo_list_items do |item| + json.id item.id + json.title item.title + json.completed item.completed +end diff --git a/app/views/todo_lists/index.json.jbuilder b/app/views/todo_lists/index.json.jbuilder new file mode 100644 index 0000000..b4561cf --- /dev/null +++ b/app/views/todo_lists/index.json.jbuilder @@ -0,0 +1,8 @@ +# json.array! @todo_lists, partial: 'todo_lists/todo_list', as: :todo_list + + +json.todo_lists @todo_lists do |todo_list| + json.partial! todo_list, as: :todo_list +end +json.page @page +json.size @size diff --git a/app/views/todo_lists/show.json.jbuilder b/app/views/todo_lists/show.json.jbuilder new file mode 100644 index 0000000..3b0c66b --- /dev/null +++ b/app/views/todo_lists/show.json.jbuilder @@ -0,0 +1,2 @@ +json.partial! "todo_lists/todo_list", todo_list: @todo_list +json.message @message if @message.present? \ No newline at end of file diff --git a/app/views/users/_user.json.jbuilder b/app/views/users/_user.json.jbuilder new file mode 100644 index 0000000..deb32dc --- /dev/null +++ b/app/views/users/_user.json.jbuilder @@ -0,0 +1,2 @@ +json.(user, :id, :email, :first_name, :last_name) +json.token user.generate_jwt_token if controller_name == "sessions" \ No newline at end of file diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder new file mode 100644 index 0000000..df7714b --- /dev/null +++ b/app/views/users/show.json.jbuilder @@ -0,0 +1,3 @@ +json.user do |json| + json.partial! 'users/user', user: current_user +end \ No newline at end of file diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..f19acf5 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..5badb2f --- /dev/null +++ b/bin/rails @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..d87d5f5 --- /dev/null +++ b/bin/rake @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..a334d86 --- /dev/null +++ b/bin/setup @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/spring b/bin/spring new file mode 100755 index 0000000..fb2ec2e --- /dev/null +++ b/bin/spring @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require 'rubygems' + require 'bundler' + + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + spring = lockfile.specs.detect { |spec| spec.name == "spring" } + if spring + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version + require 'spring/binstub' + end +end diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..67d0d49 --- /dev/null +++ b/bin/update @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..f7ba0b5 --- /dev/null +++ b/config.ru @@ -0,0 +1,5 @@ +# This file is used by Rack-based servers to start the application. + +require_relative 'config/environment' + +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..d4835cf --- /dev/null +++ b/config/application.rb @@ -0,0 +1,35 @@ +require_relative 'boot' + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +require "active_job/railtie" +require "active_record/railtie" +require "active_storage/engine" +require "action_controller/railtie" +require "action_mailer/railtie" +require "action_view/railtie" +require "action_cable/engine" +# require "sprockets/railtie" +require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module TestApp + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.2 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. + + # Only loads a smaller set of middleware suitable for API only apps. + # Middleware like session, flash, cookies can be added back manually. + # Skip views, helpers and assets when generating a new resource. + config.api_only = true + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..b9e460c --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,4 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..26aa82d --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: test_app_production diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc new file mode 100644 index 0000000..36f49d2 --- /dev/null +++ b/config/credentials.yml.enc @@ -0,0 +1 @@ +JiNiM3WEkNl81JDQpZeKz2OCB4aeBUfpvIDjte+/aY30s22tueaPtjaR/8GJtsW78Q2jd94sVWIjugx16bCJk+Lhqrt4p9nfeJL+Zb2cXxFIwQPDxGMFveWOhsBP8NlpBZQhcS0UnXU9HO5mD83jDxvmpmUesZgUj4kkO9c8ALtnkxVPvH7tb6ZwX2J7tvfL8Ydt1Uq5M8Xje5k0WytCArIvJHUgS9pLlZufIHbhELR8E2ahgD4QLY8jj/k7jmo/hPpFXxlv0TlSjrn0yK6mxK3ru2Kw7NaqAdlJJNC5XoJhJLD00nbtzKIdlV8pqI0+QphysU/BpXStImJ74kbBrzYtQrrMW8NkRIxqZbieLIMArHHwjFNyJanyJ5WRy52sO+Yy6XpDIsotKDkGsBnHN1xajF0I94V7Jq4e--cz27LaLJYYwzuWWN--r5W2gL56zhjzA/p7xyJhPA== \ No newline at end of file diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..438ea56 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,26 @@ +default: &default + adapter: postgresql + encoding: unicode + pool: 5 + + +development: + <<: *default + database: development + username: postgres + password: root + host: localhost + +test: + <<: *default + database: test + username: postgres + password: root + host: localhost + +production: + <<: *default + database: production + username: <%= ENV['DB_USER'] %> + password: <%= ENV['DB_PASSWORD'] %> + host: <%= ENV['DB_HOST'] %> diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..426333b --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..d52ec9e --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,54 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..33488d3 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,85 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "test_app_#{Rails.env}" + + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..0a38fd3 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,46 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000..89d2efa --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb new file mode 100644 index 0000000..3b1c1b5 --- /dev/null +++ b/config/initializers/cors.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Avoid CORS issues when API is called from the frontend app. +# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. + +# Read more: https://github.com/cyu/rack-cors + +# Rails.application.config.middleware.insert_before 0, Rack::Cors do +# allow do +# origins 'example.com' +# +# resource '*', +# headers: :any, +# methods: [:get, :post, :put, :patch, :delete, :options, :head] +# end +# end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..76d685f --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,299 @@ +# frozen_string_literal: true + +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # The secret key used by Devise. Devise uses this key to generate + # random tokens. Changing this key will render invalid all existing + # confirmation, reset password and unlock tokens in the database. + # Devise will use the `secret_key_base` as its `secret_key` + # by default. You can change it below and use your own secret key. + config.secret_key = '37e3d281e0cba8a5fd456848c10a4f4da9fd7888be898010f5c75271cdc83153de92055209fa5d928912e563c0a20ecb13a93e17530c0b930a8a9891fd8e3f71' + + # ==> Controller configuration + # Configure the parent class to the devise controllers. + # config.parent_controller = 'DeviseController' + + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class + # with default "from" parameter. + config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' + + # Configure the class responsible to send e-mails. + # config.mailer = 'Devise::Mailer' + + # Configure the parent class responsible to send e-mails. + # config.parent_mailer = 'ActionMailer::Base' + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [:email] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [:email] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [:email] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. The supported strategies are: + # :database = Support basic authentication with authentication key + password + # config.http_authenticatable = false + + # If 401 status code should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. 'Application' by default. + # config.http_authentication_realm = 'Application' + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # particular strategies by setting this option. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing skip: :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + + # When false, Devise will not attempt to reload routes on eager load. + # This can reduce the time taken to boot the app but if your application + # requires the Devise mappings to be loaded during boot time the application + # won't boot properly. + # config.reload_routes = true + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 11. If + # using other algorithms, it sets how many times you want the password to be hashed. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. Note that, for bcrypt (the default + # algorithm), the cost increases exponentially with the number of stretches (e.g. + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). + config.stretches = Rails.env.test? ? 1 : 11 + + # Set up a pepper to generate the hashed password. + # config.pepper = 'ed3a51677f7597649a0cb278795a51887f5b5e89ccfd953a07fab352904e4a8f46d100fad63391f345e5bf470516c27c78c1c81ce8235c60114f506498fec9f2' + + # Send a notification to the original email when the user's email is changed. + # config.send_email_changed_notification = false + + # Send a notification email when the user's password is changed. + # config.send_password_change_notification = false + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming their account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming their account, + # access will be blocked just in the third day. + # You can also set it to nil, which will allow the user to access the website + # without confirming their account. + # Default is 0.days, meaning the user cannot access the website without + # confirming their account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed, new email is stored in + # unconfirmed_email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [:email] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # secure: true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. + config.password_length = 6..128 + + # Email regex used to validate email formats. It simply asserts that + # one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [:email] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [:email] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # When set to false, does not sign a user in automatically after their password is + # reset. Defaults to true, so a user is signed in automatically after a reset. + # config.sign_in_after_reset_password = true + + # ==> Configuration for :encryptable + # Allow you to use another hashing or encryption algorithm besides bcrypt (default). + # You can use :sha1, :sha512 or algorithms from others authentication tools as + # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 + # for default behavior) and :restful_authentication_sha1 (then you should set + # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). + # + # Require the `devise-encryptable` gem when using anything other than bcrypt + # config.encryptor = :sha512 + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ['*/*', :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(scope: :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: '/my_engine' + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using OmniAuth, Devise cannot automatically set OmniAuth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = '/my_engine/users/auth' + + # ==> Turbolinks configuration + # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: + # + # ActiveSupport.on_load(:devise_failure_app) do + # include Turbolinks::Controller + # end + + # ==> Configuration for :registerable + + # When set to false, does not sign a user in automatically after their password is + # changed. Defaults to true, so a user is signed in automatically after changing a password. + # config.sign_in_after_change_password = true +end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..bbfc396 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 0000000..55617bd --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,65 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +en: + devise: + confirmations: + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." + failure: + already_authenticated: "You are already signed in." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." + locked: "Your account is locked." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." + unauthenticated: "You need to sign in or sign up before continuing." + unconfirmed: "You have to confirm your email address before continuing." + mailer: + confirmation_instructions: + subject: "Confirmation instructions" + reset_password_instructions: + subject: "Reset password instructions" + unlock_instructions: + subject: "Unlock instructions" + email_changed: + subject: "Email Changed" + password_change: + subject: "Password Changed" + omniauth_callbacks: + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." + success: "Successfully authenticated from %{kind} account." + passwords: + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." + registrations: + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." + signed_up: "Welcome! You have signed up successfully." + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." + updated: "Your account has been updated successfully." + updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again" + sessions: + signed_in: "Signed in successfully." + signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." + unlocks: + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." + unlocked: "Your account has been unlocked successfully. Please sign in to continue." + errors: + messages: + already_confirmed: "was already confirmed, please try signing in" + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" + expired: "has expired, please request a new one" + not_found: "not found" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..decc5a8 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,33 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/config/master.key b/config/master.key new file mode 100644 index 0000000..ea6b285 --- /dev/null +++ b/config/master.key @@ -0,0 +1 @@ +d24138436d1d1fbd79e72a6df05c726d \ No newline at end of file diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..a5eccf8 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,34 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. +# +# preload_app! + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..8a4a561 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,14 @@ +Rails.application.routes.draw do + scope :api, defaults: { format: :json } do + devise_for :users, controllers: { sessions: :sessions }, path_names: { sign_in: :login } + + resources :user, only: :show + resources :todo_lists, path: "todos" do + resources :todo_list_items, path: "items" do + member do + put :complete + end + end + end + end +end diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 0000000..9fa7863 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w[ + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +].each { |path| Spring.watch(path) } diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000..d32f76e --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/db/migrate/20190425102723_devise_create_users.rb b/db/migrate/20190425102723_devise_create_users.rb new file mode 100644 index 0000000..d40677b --- /dev/null +++ b/db/migrate/20190425102723_devise_create_users.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +class DeviseCreateUsers < ActiveRecord::Migration[5.2] + def change + create_table :users do |t| + ## Database authenticatable + t.string :first_name, null: false, default: "" + t.string :last_name, null: false, default: "" + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + # t.integer :sign_in_count, default: 0, null: false + # t.datetime :current_sign_in_at + # t.datetime :last_sign_in_at + # t.inet :current_sign_in_ip + # t.inet :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + + t.timestamps null: false + end + + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true + # add_index :users, :confirmation_token, unique: true + # add_index :users, :unlock_token, unique: true + end +end diff --git a/db/migrate/20190428084820_create_todo_lists.rb b/db/migrate/20190428084820_create_todo_lists.rb new file mode 100644 index 0000000..d014dba --- /dev/null +++ b/db/migrate/20190428084820_create_todo_lists.rb @@ -0,0 +1,12 @@ +class CreateTodoLists < ActiveRecord::Migration[5.2] + def change + create_table :todo_lists do |t| + t.integer :user_id + t.string :title + t.text :description + t.boolean :completed, default: false + + t.timestamps + end + end +end diff --git a/db/migrate/20190428091518_create_todo_list_items.rb b/db/migrate/20190428091518_create_todo_list_items.rb new file mode 100644 index 0000000..3a07c95 --- /dev/null +++ b/db/migrate/20190428091518_create_todo_list_items.rb @@ -0,0 +1,11 @@ +class CreateTodoListItems < ActiveRecord::Migration[5.2] + def change + create_table :todo_list_items do |t| + t.integer :todo_list_id + t.string :title + t.boolean :completed, default: false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..e2d0eb8 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,49 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 2019_04_28_091518) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "todo_list_items", force: :cascade do |t| + t.integer "todo_list_id" + t.string "title" + t.boolean "completed" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "todo_lists", force: :cascade do |t| + t.integer "user_id" + t.string "title" + t.text "description" + t.boolean "completed", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "users", force: :cascade do |t| + t.string "first_name", default: "", null: false + t.string "last_name", default: "", null: false + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..1beea2a --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). +# +# Examples: +# +# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) +# Character.create(name: 'Luke', movie: movies.first) diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/log/.keep b/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/log/development.log b/log/development.log new file mode 100644 index 0000000..03e11c1 --- /dev/null +++ b/log/development.log @@ -0,0 +1,1681 @@ +  (2191.9ms) CREATE DATABASE "development" ENCODING = 'unicode' + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (733.9ms) CREATE DATABASE "test" ENCODING = 'unicode' + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (156.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY) + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (117.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.4ms) SELECT pg_try_advisory_lock(6643483464595264770) + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Migrating to DeviseCreateUsers (20190425102723) +  (0.2ms) BEGIN + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (108.1ms) CREATE TABLE "users" ("id" bigserial primary key, "first_name" character varying DEFAULT '' NOT NULL, "last_name" character varying DEFAULT '' NOT NULL, "email" character varying DEFAULT '' NOT NULL, "encrypted_password" character varying DEFAULT '' NOT NULL, "reset_password_token" character varying, "reset_password_sent_at" timestamp, "remember_created_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) + ↳ db/migrate/20190425102723_devise_create_users.rb:5 +  (62.2ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email") + ↳ db/migrate/20190425102723_devise_create_users.rb:41 +  (73.3ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token") + ↳ db/migrate/20190425102723_devise_create_users.rb:42 + ActiveRecord::SchemaMigration Create (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190425102723"]] + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (2.4ms) COMMIT + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 + ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]] + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.3ms) BEGIN + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 + ActiveRecord::InternalMetadata Create (0.6ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2019-04-25 10:29:31.282800"], ["updated_at", "2019-04-25 10:29:31.282800"]] + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (6.3ms) COMMIT + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.5ms) SELECT pg_advisory_unlock(6643483464595264770) + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /home/peaas/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (862.7ms) CREATE DATABASE "development" ENCODING = 'unicode' + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (484.0ms) CREATE DATABASE "test" ENCODING = 'unicode' + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (35.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (4.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (1.2ms) SELECT pg_try_advisory_lock(6643483464595264770) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Migrating to DeviseCreateUsers (20190425102723) +  (0.2ms) BEGIN + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (5.0ms) CREATE TABLE "users" ("id" bigserial primary key, "first_name" character varying DEFAULT '' NOT NULL, "last_name" character varying DEFAULT '' NOT NULL, "email" character varying DEFAULT '' NOT NULL, "encrypted_password" character varying DEFAULT '' NOT NULL, "reset_password_token" character varying, "reset_password_sent_at" timestamp, "remember_created_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) + ↳ db/migrate/20190425102723_devise_create_users.rb:5 +  (1.2ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email") + ↳ db/migrate/20190425102723_devise_create_users.rb:41 +  (2.1ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token") + ↳ db/migrate/20190425102723_devise_create_users.rb:42 + ActiveRecord::SchemaMigration Create (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190425102723"]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.6ms) COMMIT + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 + ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.3ms) BEGIN + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 + ActiveRecord::InternalMetadata Create (0.6ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2019-04-28 07:43:44.186126"], ["updated_at", "2019-04-28 07:43:44.186126"]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.4ms) COMMIT + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.3ms) SELECT pg_advisory_unlock(6643483464595264770) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Started POST "/api/users/sign_up" for ::1 at 2019-04-28 13:39:47 +0530 +  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + +ActionController::RoutingError (No route matches [POST] "/api/users/sign_up"): + +actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' +railties (5.2.3) lib/rails/rack/logger.rb:38:in `call_app' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `block in call' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `block in tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:28:in `tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `tagged' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/request_id.rb:27:in `call' +rack (2.0.7) lib/rack/runtime.rb:22:in `call' +activesupport (5.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/static.rb:127:in `call' +rack (2.0.7) lib/rack/sendfile.rb:111:in `call' +railties (5.2.3) lib/rails/engine.rb:524: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 "/api/users" for ::1 at 2019-04-28 13:40:54 +0530 + +ActionController::RoutingError (undefined method `protect_from_forgery' for ApplicationController:Class): + +app/controllers/application_controller.rb:2:in `' +app/controllers/application_controller.rb:1:in `
' +Started POST "/api/users" for ::1 at 2019-04-28 13:41:21 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +Completed 500 Internal Server Error in 110ms (ActiveRecord: 0.0ms) + + + +NoMethodError (undefined method `authenticate_or_request_with_http_token' for #): + +app/controllers/application_controller.rb:15:in `authenticate_user' +Started POST "/api/users" for ::1 at 2019-04-28 13:42:43 +0530 +  (27.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + +ActionController::RoutingError (undefined method `before_filter' for ApplicationController:Class +Did you mean? before_action): + +app/controllers/application_controller.rb:3:in `' +app/controllers/application_controller.rb:1:in `
' +Started POST "/api/users" for ::1 at 2019-04-28 13:42:55 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +Completed 500 Internal Server Error in 98ms (ActiveRecord: 0.0ms) + + + +NoMethodError (undefined method `require_token' for # +Did you mean? require): + +activesupport (5.2.3) lib/active_support/callbacks.rb:426:in `block in make_lambda' +activesupport (5.2.3) lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' +actionpack (5.2.3) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in ' +activesupport (5.2.3) lib/active_support/callbacks.rb:199:in `block in halting' +activesupport (5.2.3) lib/active_support/callbacks.rb:513:in `block in invoke_before' +activesupport (5.2.3) lib/active_support/callbacks.rb:513:in `each' +activesupport (5.2.3) lib/active_support/callbacks.rb:513:in `invoke_before' +activesupport (5.2.3) lib/active_support/callbacks.rb:131:in `run_callbacks' +actionpack (5.2.3) lib/abstract_controller/callbacks.rb:41:in `process_action' +actionpack (5.2.3) lib/action_controller/metal/rescue.rb:22:in `process_action' +actionpack (5.2.3) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action' +activesupport (5.2.3) lib/active_support/notifications.rb:168:in `block in instrument' +activesupport (5.2.3) lib/active_support/notifications/instrumenter.rb:23:in `instrument' +activesupport (5.2.3) lib/active_support/notifications.rb:168:in `instrument' +actionpack (5.2.3) lib/action_controller/metal/instrumentation.rb:32:in `process_action' +actionpack (5.2.3) lib/action_controller/metal/params_wrapper.rb:256:in `process_action' +activerecord (5.2.3) lib/active_record/railties/controller_runtime.rb:24:in `process_action' +actionpack (5.2.3) lib/abstract_controller/base.rb:134:in `process' +actionview (5.2.3) lib/action_view/rendering.rb:32:in `process' +actionpack (5.2.3) lib/action_controller/metal.rb:191:in `dispatch' +actionpack (5.2.3) lib/action_controller/metal.rb:252:in `dispatch' +actionpack (5.2.3) lib/action_dispatch/routing/route_set.rb:52:in `dispatch' +actionpack (5.2.3) lib/action_dispatch/routing/route_set.rb:34:in `serve' +actionpack (5.2.3) lib/action_dispatch/routing/mapper.rb:18:in `block in ' +actionpack (5.2.3) lib/action_dispatch/routing/mapper.rb:48:in `serve' +actionpack (5.2.3) lib/action_dispatch/journey/router.rb:52:in `block in serve' +actionpack (5.2.3) lib/action_dispatch/journey/router.rb:35:in `each' +actionpack (5.2.3) lib/action_dispatch/journey/router.rb:35:in `serve' +actionpack (5.2.3) lib/action_dispatch/routing/route_set.rb:840:in `call' +warden (1.2.8) lib/warden/manager.rb:36:in `block in call' +warden (1.2.8) lib/warden/manager.rb:34:in `catch' +warden (1.2.8) lib/warden/manager.rb:34:in `call' +rack (2.0.7) lib/rack/etag.rb:25:in `call' +rack (2.0.7) lib/rack/conditional_get.rb:38:in `call' +rack (2.0.7) lib/rack/head.rb:12:in `call' +activerecord (5.2.3) lib/active_record/migration.rb:559:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' +activesupport (5.2.3) lib/active_support/callbacks.rb:98:in `run_callbacks' +actionpack (5.2.3) lib/action_dispatch/middleware/callbacks.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' +railties (5.2.3) lib/rails/rack/logger.rb:38:in `call_app' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `block in call' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `block in tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:28:in `tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `tagged' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/request_id.rb:27:in `call' +rack (2.0.7) lib/rack/runtime.rb:22:in `call' +activesupport (5.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/static.rb:127:in `call' +rack (2.0.7) lib/rack/sendfile.rb:111:in `call' +railties (5.2.3) lib/rails/engine.rb:524: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 "/api/users" for ::1 at 2019-04-28 13:43:02 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +Completed 500 Internal Server Error in 6ms (ActiveRecord: 0.0ms) + + + +NameError (uninitialized constant ApplicationController::JWT): + +app/controllers/application_controller.rb:22:in `rescue in block in authenticate_user' +app/controllers/application_controller.rb:18:in `block in authenticate_user' +app/controllers/application_controller.rb:17:in `authenticate_user' +Started POST "/api/users" for ::1 at 2019-04-28 13:44:32 +0530 +  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +Filter chain halted as :authenticate_user rendered or redirected +Completed 401 Unauthorized in 2ms (ActiveRecord: 0.0ms) + + +Started POST "/api/users" for ::1 at 2019-04-28 13:45:38 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +Completed 500 Internal Server Error in 114ms (ActiveRecord: 0.0ms) + + + +NoMethodError (undefined method `before' for #): + +activesupport (5.2.3) lib/active_support/callbacks.rb:426:in `block in make_lambda' +activesupport (5.2.3) lib/active_support/callbacks.rb:178:in `block (2 levels) in halting_and_conditional' +activesupport (5.2.3) lib/active_support/callbacks.rb:178:in `all?' +activesupport (5.2.3) lib/active_support/callbacks.rb:178:in `block in halting_and_conditional' +activesupport (5.2.3) lib/active_support/callbacks.rb:513:in `block in invoke_before' +activesupport (5.2.3) lib/active_support/callbacks.rb:513:in `each' +activesupport (5.2.3) lib/active_support/callbacks.rb:513:in `invoke_before' +activesupport (5.2.3) lib/active_support/callbacks.rb:131:in `run_callbacks' +actionpack (5.2.3) lib/abstract_controller/callbacks.rb:41:in `process_action' +actionpack (5.2.3) lib/action_controller/metal/rescue.rb:22:in `process_action' +actionpack (5.2.3) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action' +activesupport (5.2.3) lib/active_support/notifications.rb:168:in `block in instrument' +activesupport (5.2.3) lib/active_support/notifications/instrumenter.rb:23:in `instrument' +activesupport (5.2.3) lib/active_support/notifications.rb:168:in `instrument' +actionpack (5.2.3) lib/action_controller/metal/instrumentation.rb:32:in `process_action' +actionpack (5.2.3) lib/action_controller/metal/params_wrapper.rb:256:in `process_action' +activerecord (5.2.3) lib/active_record/railties/controller_runtime.rb:24:in `process_action' +actionpack (5.2.3) lib/abstract_controller/base.rb:134:in `process' +actionview (5.2.3) lib/action_view/rendering.rb:32:in `process' +actionpack (5.2.3) lib/action_controller/metal.rb:191:in `dispatch' +actionpack (5.2.3) lib/action_controller/metal.rb:252:in `dispatch' +actionpack (5.2.3) lib/action_dispatch/routing/route_set.rb:52:in `dispatch' +actionpack (5.2.3) lib/action_dispatch/routing/route_set.rb:34:in `serve' +actionpack (5.2.3) lib/action_dispatch/routing/mapper.rb:18:in `block in ' +actionpack (5.2.3) lib/action_dispatch/routing/mapper.rb:48:in `serve' +actionpack (5.2.3) lib/action_dispatch/journey/router.rb:52:in `block in serve' +actionpack (5.2.3) lib/action_dispatch/journey/router.rb:35:in `each' +actionpack (5.2.3) lib/action_dispatch/journey/router.rb:35:in `serve' +actionpack (5.2.3) lib/action_dispatch/routing/route_set.rb:840:in `call' +warden (1.2.8) lib/warden/manager.rb:36:in `block in call' +warden (1.2.8) lib/warden/manager.rb:34:in `catch' +warden (1.2.8) lib/warden/manager.rb:34:in `call' +rack (2.0.7) lib/rack/etag.rb:25:in `call' +rack (2.0.7) lib/rack/conditional_get.rb:38:in `call' +rack (2.0.7) lib/rack/head.rb:12:in `call' +activerecord (5.2.3) lib/active_record/migration.rb:559:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' +activesupport (5.2.3) lib/active_support/callbacks.rb:98:in `run_callbacks' +actionpack (5.2.3) lib/action_dispatch/middleware/callbacks.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' +railties (5.2.3) lib/rails/rack/logger.rb:38:in `call_app' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `block in call' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `block in tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:28:in `tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `tagged' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/request_id.rb:27:in `call' +rack (2.0.7) lib/rack/runtime.rb:22:in `call' +activesupport (5.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/static.rb:127:in `call' +rack (2.0.7) lib/rack/sendfile.rb:111:in `call' +railties (5.2.3) lib/rails/engine.rb:524: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 "/api/users" for ::1 at 2019-04-28 13:46:01 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +Filter chain halted as :authenticate_user rendered or redirected +Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms) + + +Started POST "/api/users" for ::1 at 2019-04-28 13:46:27 +0530 +  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +  (0.4ms) BEGIN + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Exists (25.4ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar@ymail.com"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Create (4.6ms) INSERT INTO "users" ("first_name", "last_name", "email", "encrypted_password", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["first_name", "Ajay"], ["last_name", "Babar"], ["email", "ajay.babar@ymail.com"], ["encrypted_password", "$2a$11$sn4TCIhc6wjL1habAqLBKOE7NU5SpM.QROiO2inNrY5TtijGQpAF."], ["created_at", "2019-04-28 08:16:27.834950"], ["updated_at", "2019-04-28 08:16:27.834950"]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +  (1.5ms) COMMIT + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + Rendering devise/registrations/create.json.jbuilder + Rendered users/_user.json.jbuilder (14.2ms) + Rendered devise/registrations/create.json.jbuilder (15.9ms) +Completed 500 Internal Server Error in 259ms (ActiveRecord: 56.0ms) + + + +ActionView::Template::Error (undefined method `generate_jwt' for # +Did you mean? generate_jwt_token): + 1: json.(user, :id, :email, :first_name, :last_name) + 2: json.token user.generate_jwt + +app/views/users/_user.json.jbuilder:2:in `_app_views_users__user_json_jbuilder__3937517957009779297_70247276863240' +app/views/devise/registrations/create.json.jbuilder:2:in `block in _app_views_devise_registrations_create_json_jbuilder__641384557878808652_70247276780900' +app/views/devise/registrations/create.json.jbuilder:1:in `_app_views_devise_registrations_create_json_jbuilder__641384557878808652_70247276780900' +Started POST "/api/users" for ::1 at 2019-04-28 13:47:16 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +  (0.3ms) BEGIN + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Exists (0.4ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar@ymail.com"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +  (15.1ms) ROLLBACK + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Completed 422 Unprocessable Entity in 219ms (Views: 0.4ms | ActiveRecord: 36.0ms) + + + User Load (1.9ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT $1 [["LIMIT", 1]] + User Destroy (19.9ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 1]] +Started POST "/api/users" for ::1 at 2019-04-28 13:47:40 +0530 +  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} +  (0.3ms) BEGIN + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Exists (0.9ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar@ymail.com"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Create (25.0ms) INSERT INTO "users" ("first_name", "last_name", "email", "encrypted_password", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["first_name", "Ajay"], ["last_name", "Babar"], ["email", "ajay.babar@ymail.com"], ["encrypted_password", "$2a$11$7pb.LbPjjOW/lvk5/6DdWuAq/BoPM.HH0w68HHX6/VSTAJaENZb.."], ["created_at", "2019-04-28 08:17:40.957261"], ["updated_at", "2019-04-28 08:17:40.957261"]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +  (0.8ms) COMMIT + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + Rendering devise/registrations/create.json.jbuilder + Rendered users/_user.json.jbuilder (4.6ms) + Rendered devise/registrations/create.json.jbuilder (14.4ms) +Completed 200 OK in 232ms (Views: 27.4ms | ActiveRecord: 33.3ms) + + +Started POST "/api/users/login" for ::1 at 2019-04-28 13:49:26 +0530 +Processing by SessionsController#create as JSON + Parameters: {"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]", "session"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}} + User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT $1 [["LIMIT", 1]] + ↳ app/controllers/sessions_controller.rb:3 +Completed 422 Unprocessable Entity in 15ms (Views: 0.2ms | ActiveRecord: 11.9ms) + + +Started POST "/api/users/login" for ::1 at 2019-04-28 13:49:55 +0530 +Processing by SessionsController#create as JSON + Parameters: {"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]", "session"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT $1 [["LIMIT", 1]] + ↳ app/controllers/sessions_controller.rb:6 +Completed 422 Unprocessable Entity in 31ms (Views: 0.2ms | ActiveRecord: 27.2ms) + + +Started POST "/api/users/login" for ::1 at 2019-04-28 13:50:22 +0530 +Processing by SessionsController#create as JSON + Parameters: {"user"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "session"=>{"user"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} + User Load (1.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar@ymail.com"], ["LIMIT", 1]] + ↳ app/controllers/sessions_controller.rb:6 + Rendering devise/sessions/create.json.jbuilder + Rendered users/_user.json.jbuilder (0.5ms) + Rendered devise/sessions/create.json.jbuilder (1.5ms) +Completed 200 OK in 252ms (Views: 3.3ms | ActiveRecord: 6.1ms) + + +Started POST "/api/users" for ::1 at 2019-04-28 13:51:24 +0530 +Processing by Devise::RegistrationsController#create as JSON + Parameters: {"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar1@ymail.com", "password"=>"[FILTERED]"}, "registration"=>{"user"=>{"first_name"=>"Ajay", "last_name"=>"Babar", "email"=>"ajay.babar1@ymail.com", "password"=>"[FILTERED]"}}} +  (0.3ms) BEGIN + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Exists (0.3ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar1@ymail.com"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + User Create (0.3ms) INSERT INTO "users" ("first_name", "last_name", "email", "encrypted_password", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["first_name", "Ajay"], ["last_name", "Babar"], ["email", "ajay.babar1@ymail.com"], ["encrypted_password", "$2a$11$.OqabHDfma6OEwIDeibUCeTaAPY067jyRdqPQKKy6/OhxusD/K3qm"], ["created_at", "2019-04-28 08:21:24.707951"], ["updated_at", "2019-04-28 08:21:24.707951"]] + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +  (1.0ms) COMMIT + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + Rendering devise/registrations/create.json.jbuilder + Rendered users/_user.json.jbuilder (0.3ms) + Rendered devise/registrations/create.json.jbuilder (1.2ms) +Completed 200 OK in 202ms (Views: 3.4ms | ActiveRecord: 31.9ms) + + +Started POST "/api/users/login" for ::1 at 2019-04-28 13:51:29 +0530 +Processing by SessionsController#create as JSON + Parameters: {"user"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "session"=>{"user"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} + User Load (3.7ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar@ymail.com"], ["LIMIT", 1]] + ↳ app/controllers/sessions_controller.rb:3 + Rendering devise/sessions/create.json.jbuilder + Rendered users/_user.json.jbuilder (1.1ms) + Rendered devise/sessions/create.json.jbuilder (2.2ms) +Completed 200 OK in 151ms (Views: 3.5ms | ActiveRecord: 3.7ms) + + +Started GET "/api/user" for ::1 at 2019-04-28 13:52:56 +0530 +Processing by UsersController#show as JSON + Rendering users/show.json.jbuilder + User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendered users/_user.json.jbuilder (0.4ms) + Rendered users/show.json.jbuilder (6.5ms) +Completed 200 OK in 10ms (Views: 7.5ms | ActiveRecord: 0.3ms) + + +Started GET "/api/user" for ::1 at 2019-04-28 13:53:03 +0530 +Processing by UsersController#show as JSON +Filter chain halted as :authenticate_user rendered or redirected +Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms) + + +Started GET "/api/user" for ::1 at 2019-04-28 13:53:09 +0530 +Processing by UsersController#show as JSON + Rendering users/show.json.jbuilder + User Load (4.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendered users/_user.json.jbuilder (0.6ms) + Rendered users/show.json.jbuilder (7.9ms) +Completed 200 OK in 11ms (Views: 4.6ms | ActiveRecord: 4.7ms) + + +  (0.6ms) SELECT pg_try_advisory_lock(6643483464595264770) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Migrating to CreateTodoLists (20190428084820) +  (0.5ms) BEGIN + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (38.3ms) CREATE TABLE "todo_lists" ("id" bigserial primary key, "user_id" integer, "title" character varying, "description" text, "completed" boolean DEFAULT FALSE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) + ↳ db/migrate/20190428084820_create_todo_lists.rb:3 + ActiveRecord::SchemaMigration Create (0.6ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190428084820"]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.7ms) COMMIT + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 + ActiveRecord::InternalMetadata Load (3.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.4ms) BEGIN + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (20.0ms) COMMIT + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.6ms) SELECT pg_advisory_unlock(6643483464595264770) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Started POST "/api/todo_lists" for ::1 at 2019-04-28 14:26:37 +0530 +  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListsController#create as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} +Filter chain halted as :authenticate_user rendered or redirected +Completed 401 Unauthorized in 5ms (ActiveRecord: 0.0ms) + + +Started POST "/api/todo_lists" for ::1 at 2019-04-28 14:27:07 +0530 +  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListsController#create as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} +Filter chain halted as :authenticate_user rendered or redirected +Completed 401 Unauthorized in 6ms (ActiveRecord: 0.0ms) + + +Started POST "/api/users/login" for ::1 at 2019-04-28 14:27:20 +0530 +Processing by SessionsController#create as JSON + Parameters: {"user"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}, "session"=>{"user"=>{"email"=>"ajay.babar@ymail.com", "password"=>"[FILTERED]"}}} + User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "ajay.babar@ymail.com"], ["LIMIT", 1]] + ↳ app/controllers/sessions_controller.rb:3 + Rendering devise/sessions/create.json.jbuilder + Rendered users/_user.json.jbuilder (1.0ms) + Rendered devise/sessions/create.json.jbuilder (6.5ms) +Completed 200 OK in 216ms (Views: 12.7ms | ActiveRecord: 33.2ms) + + +Started POST "/api/todo_lists" for ::1 at 2019-04-28 14:27:34 +0530 +Processing by TodoListsController#create as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 +  (0.2ms) BEGIN + ↳ app/controllers/todo_lists_controller.rb:17 + TodoList Create (23.2ms) INSERT INTO "todo_lists" ("user_id", "title", "description", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["user_id", 2], ["title", "This is first ToDoList"], ["description", "Test"], ["created_at", "2019-04-28 08:57:35.115311"], ["updated_at", "2019-04-28 08:57:35.115311"]] + ↳ app/controllers/todo_lists_controller.rb:17 +  (0.6ms) COMMIT + ↳ app/controllers/todo_lists_controller.rb:17 +Completed 500 Internal Server Error in 259ms (ActiveRecord: 64.0ms) + + + +NoMethodError (undefined method `todo_list_url' for # +Did you mean? todo_lists_url): + +app/controllers/todo_lists_controller.rb:18:in `create' +Started POST "/api/todo_lists" for ::1 at 2019-04-28 14:28:59 +0530 +Processing by TodoListsController#create as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 +  (0.2ms) BEGIN + ↳ app/controllers/todo_lists_controller.rb:17 + TodoList Create (0.5ms) INSERT INTO "todo_lists" ("user_id", "title", "description", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["user_id", 2], ["title", "This is first ToDoList"], ["description", "Test"], ["created_at", "2019-04-28 08:58:59.816177"], ["updated_at", "2019-04-28 08:58:59.816177"]] + ↳ app/controllers/todo_lists_controller.rb:17 +  (25.2ms) COMMIT + ↳ app/controllers/todo_lists_controller.rb:17 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (246.1ms) + Rendered todo_lists/show.json.jbuilder (248.1ms) +Completed 500 Internal Server Error in 384ms (ActiveRecord: 86.0ms) + + + +ActionView::Template::Error (undefined method `todo_list_url' for #<#:0x00007f9325484120> +Did you mean? todo_lists_url): + 1: json.extract! todo_list, :id, :title, :description, :completed, :created_at, :updated_at + 2: json.url todo_list_url(todo_list, format: :json) + +app/views/todo_lists/_todo_list.json.jbuilder:2:in `_app_views_todo_lists__todo_list_json_jbuilder__302463862037125097_70134983976380' +app/views/todo_lists/show.json.jbuilder:1:in `_app_views_todo_lists_show_json_jbuilder__1324670851995834859_70134983930100' +app/controllers/todo_lists_controller.rb:18:in `create' +Started POST "/api/todo_lists" for ::1 at 2019-04-28 14:30:12 +0530 +Processing by TodoListsController#create as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 +  (0.3ms) BEGIN + ↳ app/controllers/todo_lists_controller.rb:17 + TodoList Create (0.6ms) INSERT INTO "todo_lists" ("user_id", "title", "description", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["user_id", 2], ["title", "This is first ToDoList"], ["description", "Test"], ["created_at", "2019-04-28 09:00:12.250407"], ["updated_at", "2019-04-28 09:00:12.250407"]] + ↳ app/controllers/todo_lists_controller.rb:17 +  (0.6ms) COMMIT + ↳ app/controllers/todo_lists_controller.rb:17 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.4ms) + Rendered todo_lists/show.json.jbuilder (1.7ms) +Completed 201 Created in 19ms (Views: 11.9ms | ActiveRecord: 2.1ms) + + +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:30:30 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 +Completed 404 Not Found in 2ms (ActiveRecord: 0.4ms) + + + +ActiveRecord::RecordNotFound (Couldn't find TodoList without an ID): + +app/controllers/todo_lists_controller.rb:38:in `set_todo_list' +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:31:32 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 +Completed 404 Not Found in 85ms (ActiveRecord: 63.4ms) + + + +ActiveRecord::RecordNotFound (Couldn't find TodoList without an ID): + +app/controllers/todo_lists_controller.rb:41:in `set_todo_list' +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:32:34 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 +Completed 404 Not Found in 38ms (ActiveRecord: 20.3ms) + + + +ActiveRecord::RecordNotFound (Couldn't find TodoList without an ID): + +app/controllers/todo_lists_controller.rb:41:in `set_todo_list' +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:34:18 +0530 +  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.7ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/controllers/todo_lists_controller.rb:10 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 0], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/index.json.jbuilder (5.3ms) +Completed 200 OK in 105ms (Views: 10.7ms | ActiveRecord: 40.3ms) + + +Started GET "/api/todo_lists/1" for ::1 at 2019-04-28 14:34:39 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}, "id"=>"1"} + User Load (2.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (3.1ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:41 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.9ms) + Rendered todo_lists/show.json.jbuilder (3.3ms) +Completed 200 OK in 17ms (Views: 4.7ms | ActiveRecord: 5.6ms) + + +Started GET "/api/todo_lists/2" for ::1 at 2019-04-28 14:34:43 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}, "id"=>"2"} + User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (1.2ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:41 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.6ms) + Rendered todo_lists/show.json.jbuilder (2.2ms) +Completed 200 OK in 10ms (Views: 3.5ms | ActiveRecord: 1.8ms) + + +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:34:49 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/controllers/todo_lists_controller.rb:10 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 0], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/index.json.jbuilder (1.5ms) +Completed 200 OK in 9ms (Views: 2.2ms | ActiveRecord: 1.1ms) + + +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:35:17 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 0], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/index.json.jbuilder (1.8ms) +Completed 200 OK in 43ms (Views: 3.1ms | ActiveRecord: 21.4ms) + + +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:35:25 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/index.json.jbuilder (31.0ms) +Completed 500 Internal Server Error in 54ms (ActiveRecord: 19.7ms) + + + +ActionView::Template::Error ({:partial=>"todo_lists/todo_list"} is not a symbol nor a string): + 1: json.array! @todo_lists, partial: 'todo_lists/todo_list' + +app/views/todo_lists/index.json.jbuilder:1:in `_app_views_todo_lists_index_json_jbuilder__124419218200032273_70224781539840' +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:35:32 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (21.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (1.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (0.7ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.4ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.1ms) + Rendered todo_lists/index.json.jbuilder (8.4ms) +Completed 200 OK in 35ms (Views: 9.5ms | ActiveRecord: 22.2ms) + + +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:38:23 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (20.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 0], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/index.json.jbuilder (31.4ms) +Completed 200 OK in 82ms (Views: 12.3ms | ActiveRecord: 51.0ms) + + +Started GET "/api/todo_lists" for ::1 at 2019-04-28 14:40:04 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}} + User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.1ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.0ms) + Rendered todo_lists/index.json.jbuilder (40.7ms) +Completed 200 OK in 94ms (Views: 15.3ms | ActiveRecord: 55.7ms) + + +Started GET "/api/todo_lists/1" for ::1 at 2019-04-28 14:40:08 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList", "description"=>"Test"}, "id"=>"1"} + User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/show.json.jbuilder (1.9ms) +Completed 200 OK in 9ms (Views: 3.1ms | ActiveRecord: 0.8ms) + + +Started PUT "/api/todo_lists/1" for ::1 at 2019-04-28 14:40:22 +0530 +Processing by TodoListsController#update as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList - One", "description"=>"Test - 1"}, "id"=>"1"} + User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 +  (0.3ms) BEGIN + ↳ app/controllers/todo_lists_controller.rb:23 + TodoList Update (2.0ms) UPDATE "todo_lists" SET "title" = $1, "description" = $2, "updated_at" = $3 WHERE "todo_lists"."id" = $4 [["title", "This is first ToDoList - One"], ["description", "Test - 1"], ["updated_at", "2019-04-28 09:10:22.969457"], ["id", 1]] + ↳ app/controllers/todo_lists_controller.rb:23 +  (1.5ms) COMMIT + ↳ app/controllers/todo_lists_controller.rb:23 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.6ms) + Rendered todo_lists/show.json.jbuilder (2.0ms) +Completed 200 OK in 18ms (Views: 3.5ms | ActiveRecord: 4.9ms) + + +Started DELETE "/api/todo_lists/2" for ::1 at 2019-04-28 14:41:13 +0530 +Processing by TodoListsController#destroy as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList - One", "description"=>"Test - 1"}, "id"=>"2"} + User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (1.2ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 +  (0.5ms) BEGIN + ↳ app/controllers/todo_lists_controller.rb:31 + TodoList Destroy (0.4ms) DELETE FROM "todo_lists" WHERE "todo_lists"."id" = $1 [["id", 2]] + ↳ app/controllers/todo_lists_controller.rb:31 +  (0.5ms) COMMIT + ↳ app/controllers/todo_lists_controller.rb:31 +No template found for TodoListsController#destroy, rendering head :no_content +Completed 204 No Content in 60ms (ActiveRecord: 4.3ms) + + +Started GET "/api/todo_lists/2" for ::1 at 2019-04-28 14:41:17 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList - One", "description"=>"Test - 1"}, "id"=>"2"} + User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 +Completed 404 Not Found in 6ms (ActiveRecord: 1.9ms) + + + +ActiveRecord::RecordNotFound (Couldn't find TodoList with 'id'=2 [WHERE "todo_lists"."user_id" = $1]): + +app/controllers/todo_lists_controller.rb:36:in `set_todo_list' +Started GET "/api/todo_lists/2" for ::1 at 2019-04-28 14:41:39 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList - One", "description"=>"Test - 1"}, "id"=>"2"} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 +Completed 404 Not Found in 49ms (ActiveRecord: 30.3ms) + + + +ActiveRecord::RecordNotFound (Couldn't find TodoList with 'id'=2 [WHERE "todo_lists"."user_id" = $1]): + +app/controllers/todo_lists_controller.rb:36:in `set_todo_list' +Started GET "/api/todo_lists/2" for ::1 at 2019-04-28 14:42:09 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList - One", "description"=>"Test - 1"}, "id"=>"2"} + User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.2ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 +Completed 404 Not Found in 40ms (ActiveRecord: 18.9ms) + + + +ActiveRecord::RecordNotFound (Couldn't find TodoList with 'id'=2 [WHERE "todo_lists"."user_id" = $1]): + +app/controllers/todo_lists_controller.rb:36:in `set_todo_list' +Started GET "/api/todo_lists/1/items" for ::1 at 2019-04-28 14:52:55 +0530 +  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + +ActiveRecord::PendingMigrationError ( + +Migrations are pending. To resolve this issue, run: + + bin/rails db:migrate RAILS_ENV=development + +): + +activerecord (5.2.3) lib/active_record/migration.rb:579:in `check_pending!' +activerecord (5.2.3) lib/active_record/migration.rb:556:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' +activesupport (5.2.3) lib/active_support/callbacks.rb:98:in `run_callbacks' +actionpack (5.2.3) lib/action_dispatch/middleware/callbacks.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' +railties (5.2.3) lib/rails/rack/logger.rb:38:in `call_app' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `block in call' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `block in tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:28:in `tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `tagged' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/request_id.rb:27:in `call' +rack (2.0.7) lib/rack/runtime.rb:22:in `call' +activesupport (5.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/static.rb:127:in `call' +rack (2.0.7) lib/rack/sendfile.rb:111:in `call' +railties (5.2.3) lib/rails/engine.rb:524: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' +  (0.6ms) SELECT pg_try_advisory_lock(6643483464595264770) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Migrating to CreateTodoListItems (20190428091518) +  (0.3ms) BEGIN + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (35.4ms) CREATE TABLE "todo_list_items" ("id" bigserial primary key, "todo_list_id" integer, "title" character varying, "completed" boolean, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) + ↳ db/migrate/20190428091518_create_todo_list_items.rb:3 + ActiveRecord::SchemaMigration Create (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20190428091518"]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.7ms) COMMIT + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 + ActiveRecord::InternalMetadata Load (0.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]] + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (19.5ms) BEGIN + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.4ms) COMMIT + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.5ms) SELECT pg_advisory_unlock(6643483464595264770) + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273 +Started GET "/api/todo_lists/1/items" for ::1 at 2019-04-28 14:53:13 +0530 +  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 + +ActionController::RoutingError (No route matches [GET] "/api/todo_lists/1/items"): + +actionpack (5.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' +railties (5.2.3) lib/rails/rack/logger.rb:38:in `call_app' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `block in call' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `block in tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:28:in `tagged' +activesupport (5.2.3) lib/active_support/tagged_logging.rb:71:in `tagged' +railties (5.2.3) lib/rails/rack/logger.rb:26:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/request_id.rb:27:in `call' +rack (2.0.7) lib/rack/runtime.rb:22:in `call' +activesupport (5.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/executor.rb:14:in `call' +actionpack (5.2.3) lib/action_dispatch/middleware/static.rb:127:in `call' +rack (2.0.7) lib/rack/sendfile.rb:111:in `call' +railties (5.2.3) lib/rails/engine.rb:524: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 "/api/todos/1/items" for ::1 at 2019-04-28 14:53:21 +0530 +Processing by TodoListItemsController#index as JSON + Parameters: {"todo_list"=>{"title"=>"This is first ToDoList - One", "description"=>"Test - 1"}, "todo_list_id"=>"1", "todo_list_item"=>{}} + TodoList Load (1.2ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 + Rendering todo_list_items/index.json.jbuilder + TodoListItem Load (1.7ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_list_items/index.json.jbuilder:1 + Rendered todo_list_items/index.json.jbuilder (18.8ms) +Completed 200 OK in 86ms (Views: 23.0ms | ActiveRecord: 28.1ms) + + +Started POST "/api/todos/1/items" for ::1 at 2019-04-28 14:53:42 +0530 +Processing by TodoListItemsController#create as JSON + Parameters: {"todo_list_item"=>{"title"=>"Eat"}, "todo_list_id"=>"1"} + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 +  (23.0ms) BEGIN + ↳ app/controllers/todo_list_items_controller.rb:15 + TodoListItem Create (1.7ms) INSERT INTO "todo_list_items" ("todo_list_id", "title", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["todo_list_id", 1], ["title", "Eat"], ["created_at", "2019-04-28 09:23:42.559108"], ["updated_at", "2019-04-28 09:23:42.559108"]] + ↳ app/controllers/todo_list_items_controller.rb:15 +  (0.6ms) COMMIT + ↳ app/controllers/todo_list_items_controller.rb:15 + Rendering todo_list_items/show.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (280.3ms) + Rendered todo_list_items/show.json.jbuilder (281.9ms) +Completed 500 Internal Server Error in 338ms (ActiveRecord: 27.6ms) + + + +ActionView::Template::Error (undefined method `todo_list_item_url' for #<#:0x00007fb6f206d4b0> +Did you mean? todo_list_url + todo_lists_url): + 1: json.extract! todo_list_item, :id, :todo_list_id, :title, :completed, :created_at, :updated_at + 2: json.url todo_list_item_url(todo_list_item, format: :json) + +app/views/todo_list_items/_todo_list_item.json.jbuilder:2:in `_app_views_todo_list_items__todo_list_item_json_jbuilder__2189274463754527573_70211860671300' +app/views/todo_list_items/show.json.jbuilder:1:in `_app_views_todo_list_items_show_json_jbuilder___1791090288159137892_70211860652220' +app/controllers/todo_list_items_controller.rb:16:in `create' +Started GET "/api/todos/1/items" for ::1 at 2019-04-28 14:54:12 +0530 +Processing by TodoListItemsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Eat"}, "todo_list_id"=>"1"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 + Rendering todo_list_items/index.json.jbuilder + TodoListItem Load (0.3ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_list_items/index.json.jbuilder:1 + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.4ms) + Rendered todo_list_items/index.json.jbuilder (13.5ms) +Completed 200 OK in 43ms (Views: 11.2ms | ActiveRecord: 14.2ms) + + +Started POST "/api/todos/1/items" for ::1 at 2019-04-28 14:54:43 +0530 +  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListItemsController#create as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep"}, "todo_list_id"=>"1"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 +  (0.3ms) BEGIN + ↳ app/controllers/todo_list_items_controller.rb:15 + TodoListItem Create (0.5ms) INSERT INTO "todo_list_items" ("todo_list_id", "title", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["todo_list_id", 1], ["title", "Sleep"], ["created_at", "2019-04-28 09:24:43.771870"], ["updated_at", "2019-04-28 09:24:43.771870"]] + ↳ app/controllers/todo_list_items_controller.rb:15 +  (0.9ms) COMMIT + ↳ app/controllers/todo_list_items_controller.rb:15 + Rendering todo_list_items/show.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.4ms) + Rendered todo_list_items/show.json.jbuilder (1.5ms) +Completed 201 Created in 99ms (Views: 2.9ms | ActiveRecord: 61.2ms) + + +Started GET "/api/todos/1/items" for ::1 at 2019-04-28 14:54:47 +0530 +Processing by TodoListItemsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep"}, "todo_list_id"=>"1"} + TodoList Load (0.8ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 + Rendering todo_list_items/index.json.jbuilder + TodoListItem Load (0.7ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_list_items/index.json.jbuilder:1 + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.5ms) + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.1ms) + Rendered todo_list_items/index.json.jbuilder (5.7ms) +Completed 200 OK in 10ms (Views: 6.2ms | ActiveRecord: 1.5ms) + + +Started GET "/api/todos/1/items/1" for ::1 at 2019-04-28 14:54:52 +0530 +Processing by TodoListItemsController#show as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep"}, "todo_list_id"=>"1", "id"=>"1"} + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:36 + Rendering todo_list_items/show.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.5ms) + Rendered todo_list_items/show.json.jbuilder (2.0ms) +Completed 200 OK in 9ms (Views: 3.6ms | ActiveRecord: 0.9ms) + + +Started PUT "/api/todos/1/items/1" for ::1 at 2019-04-28 14:55:04 +0530 +Processing by TodoListItemsController#update as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"1"} + TodoList Load (0.9ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 + TodoListItem Load (1.2ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:36 +  (1.4ms) BEGIN + ↳ app/controllers/todo_list_items_controller.rb:23 + TodoListItem Update (2.5ms) UPDATE "todo_list_items" SET "title" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["title", "Sleep - 1"], ["updated_at", "2019-04-28 09:25:04.422592"], ["id", 1]] + ↳ app/controllers/todo_list_items_controller.rb:23 +  (1.9ms) COMMIT + ↳ app/controllers/todo_list_items_controller.rb:23 + Rendering todo_list_items/show.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.6ms) + Rendered todo_list_items/show.json.jbuilder (2.3ms) +Completed 200 OK in 19ms (Views: 4.0ms | ActiveRecord: 7.9ms) + + +Started DELETE "/api/todos/1/items/1" for ::1 at 2019-04-28 14:55:08 +0530 +Processing by TodoListItemsController#destroy as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"1"} + TodoList Load (1.1ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:41 + TodoListItem Load (1.5ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:36 +  (0.3ms) BEGIN + ↳ app/controllers/todo_list_items_controller.rb:31 + TodoListItem Destroy (1.0ms) DELETE FROM "todo_list_items" WHERE "todo_list_items"."id" = $1 [["id", 1]] + ↳ app/controllers/todo_list_items_controller.rb:31 +  (1.8ms) COMMIT + ↳ app/controllers/todo_list_items_controller.rb:31 +No template found for TodoListItemsController#destroy, rendering head :no_content +Completed 204 No Content in 64ms (ActiveRecord: 5.7ms) + + +Started GET "/api/todos/1/items" for ::1 at 2019-04-28 15:00:39 +0530 +Processing by TodoListItemsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1"} + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:45 + Rendering todo_list_items/index.json.jbuilder + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_list_items/index.json.jbuilder:1 + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.3ms) + Rendered todo_list_items/index.json.jbuilder (37.4ms) +Completed 200 OK in 81ms (Views: 11.1ms | ActiveRecord: 50.9ms) + + +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:00:51 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (1.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:45 +Completed 500 Internal Server Error in 5ms (ActiveRecord: 1.4ms) + + + +NoMethodError (undefined method `complete' for nil:NilClass): + +app/controllers/todo_list_items_controller.rb:35:in `complete' +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:02:09 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:48 +Completed 500 Internal Server Error in 45ms (ActiveRecord: 26.0ms) + + + +NoMethodError (undefined method `complete' for nil:NilClass): + +app/controllers/todo_list_items_controller.rb:35:in `complete' +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:03:37 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 +Completed 500 Internal Server Error in 54ms (ActiveRecord: 25.2ms) + + + +NoMethodError (undefined method `complete' for nil:NilClass): + +app/controllers/todo_list_items_controller.rb:38:in `complete' +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:04:19 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 +Completed 500 Internal Server Error in 40ms (ActiveRecord: 24.0ms) + + + +NoMethodError (undefined method `complete' for nil:NilClass): + +app/controllers/todo_list_items_controller.rb:38:in `complete' +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:04:53 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (1.2ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.5ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (18.3ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:34:53.688158"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.8ms) COMMIT + ↳ app/models/todo_list_item.rb:7 +No template found for TodoListItemsController#complete, rendering head :no_content +Completed 204 No Content in 117ms (ActiveRecord: 49.7ms) + + +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:05:31 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (1.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.7ms) BEGIN + ↳ app/models/todo_list_item.rb:7 +  (21.7ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.4ms) + Rendered todo_list_items/complete.json.jbuilder (1.9ms) +Completed 200 OK in 34ms (Views: 3.3ms | ActiveRecord: 24.1ms) + + +Started PUT "/api/todos/1" for ::1 at 2019-04-28 15:05:41 +0530 +Processing by TodoListsController#update as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "id"=>"1", "todo_list"=>{}} + User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 +Completed 400 Bad Request in 55ms (ActiveRecord: 34.6ms) + + + +ActionController::ParameterMissing (param is missing or the value is empty: todo_list): + +app/controllers/todo_lists_controller.rb:41:in `todo_list_params' +app/controllers/todo_lists_controller.rb:23:in `update' +Started GET "/api/todos/1" for ::1 at 2019-04-28 15:05:54 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "id"=>"1", "todo_list"=>{}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.4ms) + Rendered todo_lists/show.json.jbuilder (2.1ms) +Completed 200 OK in 9ms (Views: 3.5ms | ActiveRecord: 0.9ms) + + +Started GET "/api/todos/1/items" for ::1 at 2019-04-28 15:06:02 +0530 +Processing by TodoListItemsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1"} + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + Rendering todo_list_items/index.json.jbuilder + TodoListItem Load (0.6ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_list_items/index.json.jbuilder:1 + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.6ms) + Rendered todo_list_items/index.json.jbuilder (5.0ms) +Completed 200 OK in 10ms (Views: 5.8ms | ActiveRecord: 1.0ms) + + +Started PUT "/api/todos/1/items/1/complete" for ::1 at 2019-04-28 15:07:45 +0530 +  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"1"} + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.5ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +Filter chain halted as :set_todo_list_item rendered or redirected +Completed 404 Not Found in 53ms (Views: 0.3ms | ActiveRecord: 16.5ms) + + +Started PUT "/api/todos/2/items/1/complete" for ::1 at 2019-04-28 15:07:57 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"2", "id"=>"1"} + TodoList Load (1.6ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 +Filter chain halted as :set_todo_list rendered or redirected +Completed 404 Not Found in 4ms (Views: 0.2ms | ActiveRecord: 1.6ms) + + +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:08:05 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.9ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.8ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.4ms) BEGIN + ↳ app/models/todo_list_item.rb:7 +  (0.3ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.7ms) + Rendered todo_list_items/complete.json.jbuilder (5.7ms) +Completed 200 OK in 62ms (Views: 11.3ms | ActiveRecord: 10.6ms) + + + TodoListItem Load (0.5ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (1.6ms) BEGIN + TodoList Load (25.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", false], ["updated_at", "2019-04-28 09:38:55.355328"], ["id", 2]] +  (1.3ms) COMMIT +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:09:06 +0530 +  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.6ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.6ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:39:06.815670"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.9ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.6ms) + Rendered todo_list_items/complete.json.jbuilder (2.9ms) +Completed 200 OK in 72ms (Views: 6.1ms | ActiveRecord: 24.8ms) + + + TodoListItem Load (0.5ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] + TodoListItem Load (3.1ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (0.4ms) BEGIN + TodoList Load (1.0ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", false], ["updated_at", "2019-04-28 09:41:57.690108"], ["id", 2]] +  (0.7ms) COMMIT +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:12:04 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.2ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (22.1ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:42:04.494371"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.9ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.4ms) + Rendered todo_list_items/complete.json.jbuilder (2.1ms) +Completed 200 OK in 69ms (Views: 3.3ms | ActiveRecord: 34.1ms) + + + TodoListItem Load (8.1ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (0.5ms) BEGIN + TodoList Load (0.7ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + TodoListItem Update (0.5ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", false], ["updated_at", "2019-04-28 09:42:30.240225"], ["id", 2]] +  (0.8ms) COMMIT +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:13:04 +0530 +  (23.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.6ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.6ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.4ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:43:04.591253"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.7ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.7ms) + Rendered todo_list_items/complete.json.jbuilder (5.8ms) +Completed 200 OK in 92ms (Views: 11.9ms | ActiveRecord: 25.1ms) + + + TodoListItem Load (22.2ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (6.8ms) BEGIN + TodoList Load (0.8ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + TodoListItem Update (1.1ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", false], ["updated_at", "2019-04-28 09:44:27.623397"], ["id", 2]] +  (2.9ms) COMMIT +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:14:33 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (22.8ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.3ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.3ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (22.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:44:33.547450"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.7ms) ROLLBACK + ↳ app/models/todo_list_item.rb:7 +Completed 500 Internal Server Error in 107ms (ActiveRecord: 56.4ms) + + + +NameError (undefined local variable or method `completed_changed' for # +Did you mean? completed_changed? + completed_change): + +app/models/todo_list_item.rb:13:in `update_todo_list' +app/models/todo_list_item.rb:7:in `complete' +app/controllers/todo_list_items_controller.rb:38:in `complete' + TodoListItem Load (0.9ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (0.4ms) BEGIN + TodoList Load (0.8ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] +  (0.5ms) COMMIT + TodoListItem Load (11.5ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (0.5ms) BEGIN + TodoList Load (21.8ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] +  (0.5ms) COMMIT +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:15:03 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (19.3ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:45:04.073494"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.8ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (1.8ms) + Rendered todo_list_items/complete.json.jbuilder (4.5ms) +Completed 200 OK in 97ms (Views: 5.8ms | ActiveRecord: 54.2ms) + + + TodoListItem Load (8.8ms) SELECT "todo_list_items".* FROM "todo_list_items" ORDER BY "todo_list_items"."id" DESC LIMIT $1 [["LIMIT", 1]] +  (0.5ms) BEGIN + TodoList Load (0.7ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + TodoListItem Update (0.7ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", false], ["updated_at", "2019-04-28 09:46:08.876636"], ["id", 2]] +  (0.9ms) COMMIT +Started PUT "/api/todos/1/items/2/complete" for ::1 at 2019-04-28 15:16:20 +0530 +Processing by TodoListItemsController#complete as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list_id"=>"1", "id"=>"2"} + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:51 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 AND "todo_list_items"."id" = $2 LIMIT $3 [["todo_list_id", 1], ["id", 2], ["LIMIT", 1]] + ↳ app/controllers/todo_list_items_controller.rb:43 +  (0.4ms) BEGIN + ↳ app/models/todo_list_item.rb:7 + TodoListItem Update (0.5ms) UPDATE "todo_list_items" SET "completed" = $1, "updated_at" = $2 WHERE "todo_list_items"."id" = $3 [["completed", true], ["updated_at", "2019-04-28 09:46:20.641182"], ["id", 2]] + ↳ app/models/todo_list_item.rb:7 +  (0.8ms) COMMIT + ↳ app/models/todo_list_item.rb:7 + Rendering todo_list_items/complete.json.jbuilder + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.6ms) + Rendered todo_list_items/complete.json.jbuilder (2.0ms) +Completed 200 OK in 60ms (Views: 3.3ms | ActiveRecord: 28.2ms) + + +Started GET "/api/todos/1" for ::1 at 2019-04-28 15:16:33 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "id"=>"1", "todo_list"=>{}} + User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 + Rendering todo_lists/show.json.jbuilder + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/show.json.jbuilder (2.5ms) +Completed 200 OK in 59ms (Views: 4.3ms | ActiveRecord: 6.7ms) + + +Started GET "/api/todos/1" for ::1 at 2019-04-28 15:18:05 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "id"=>"1", "todo_list"=>{}} + User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (0.6ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 + Rendering todo_lists/show.json.jbuilder + TodoListItem Load (0.3ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_lists/_todo_list.json.jbuilder:2 + Rendered todo_list_items/_todo_list_item.json.jbuilder (559.7ms) + Rendered todo_lists/_todo_list.json.jbuilder (579.5ms) + Rendered todo_lists/show.json.jbuilder (580.5ms) +Completed 500 Internal Server Error in 640ms (ActiveRecord: 52.0ms) + + + +ActionView::Template::Error (undefined local variable or method `todo_list_item' for #<#:0x00007ff8d71d6910> +Did you mean? todo_list_items + todo_list_path + todo_list_url): + 1: json.extract! todo_list_item, :id, :todo_list_id, :title, :completed + +app/views/todo_list_items/_todo_list_item.json.jbuilder:1:in `_app_views_todo_list_items__todo_list_item_json_jbuilder__524547588048188025_70353368883220' +app/views/todo_lists/_todo_list.json.jbuilder:2:in `_app_views_todo_lists__todo_list_json_jbuilder__1804138972933900965_70353368838200' +app/views/todo_lists/show.json.jbuilder:1:in `_app_views_todo_lists_show_json_jbuilder___1834524202837939058_70353368803860' +Started GET "/api/todos/1" for ::1 at 2019-04-28 15:19:07 +0530 +Processing by TodoListsController#show as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "id"=>"1", "todo_list"=>{}} + User Load (7.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + TodoList Load (6.1ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 AND "todo_lists"."id" = $2 LIMIT $3 [["user_id", 2], ["id", 1], ["LIMIT", 1]] + ↳ app/controllers/todo_lists_controller.rb:36 + Rendering todo_lists/show.json.jbuilder + TodoListItem Load (22.0ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" = $1 [["todo_list_id", 1]] + ↳ app/views/todo_lists/_todo_list.json.jbuilder:2 + Rendered todo_list_items/_todo_list_item.json.jbuilder (0.4ms) + Rendered todo_lists/_todo_list.json.jbuilder (25.9ms) + Rendered todo_lists/show.json.jbuilder (27.1ms) +Completed 500 Internal Server Error in 47ms (ActiveRecord: 35.3ms) + + + +ActionView::Template::Error (Can't merge [{"id"=>2, "todo_list_id"=>1, "title"=>"Sleep", "completed"=>true}] into {"id"=>1, "title"=>"This is first ToDoList - One", "description"=>"Test - 1", "completed"=>false}): + 1: json.extract! todo_list, :id, :title, :description, :completed + 2: json.array! todo_list.todo_list_items, partial: 'todo_list_items/todo_list_item', as: :todo_list_item + +app/views/todo_lists/_todo_list.json.jbuilder:2:in `_app_views_todo_lists__todo_list_json_jbuilder__1804138972933900965_70353347003040' +app/views/todo_lists/show.json.jbuilder:1:in `_app_views_todo_lists_show_json_jbuilder___1834524202837939058_70353346992080' +Started GET "/api/todos" for ::1 at 2019-04-28 15:19:18 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (19.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.3ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + TodoListItem Load (0.8ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (2.4ms) + Rendered todo_lists/index.json.jbuilder (22.4ms) +Completed 500 Internal Server Error in 47ms (ActiveRecord: 20.9ms) + + + +ActionView::Template::Error (Can't merge [] into {"id"=>3, "title"=>"This is first ToDoList", "description"=>"Test", "completed"=>false}): + 1: json.extract! todo_list, :id, :title, :description, :completed + 2: json.array! todo_list.todo_list_items, partial: 'todo_list_items/todo_list_item', as: :todo_list_item + +app/views/todo_lists/_todo_list.json.jbuilder:2:in `_app_views_todo_lists__todo_list_json_jbuilder__1804138972933900965_70353347251340' +app/views/todo_lists/index.json.jbuilder:1:in `_app_views_todo_lists_index_json_jbuilder___3226934103515759998_70353347199800' +Started GET "/api/todos" for ::1 at 2019-04-28 15:19:32 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.9ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + TodoListItem Load (0.9ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (2.3ms) + Rendered todo_lists/index.json.jbuilder (8.8ms) +Completed 500 Internal Server Error in 16ms (ActiveRecord: 3.0ms) + + + +ActionView::Template::Error (Can't merge [] into {"id"=>3, "title"=>"This is first ToDoList", "description"=>"Test", "completed"=>false}): + 1: json.extract! todo_list, :id, :title, :description, :completed + 2: json.array! todo_list.todo_list_items, partial: 'todo_list_items/todo_list_item', as: :todo_list_items + +app/views/todo_lists/_todo_list.json.jbuilder:2:in `_app_views_todo_lists__todo_list_json_jbuilder__1804138972933900965_70353345869840' +app/views/todo_lists/index.json.jbuilder:1:in `_app_views_todo_lists_index_json_jbuilder___3226934103515759998_70353344314920' +Started GET "/api/todos" for ::1 at 2019-04-28 15:22:08 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.7ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + TodoListItem Load (10.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (0.6ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.2ms) + Rendered todo_lists/index.json.jbuilder (16.7ms) +Completed 200 OK in 23ms (Views: 7.6ms | ActiveRecord: 11.6ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:25:42 +0530 +  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + TodoListItem Load (1.2ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.3ms) + Rendered todo_lists/index.json.jbuilder (42.8ms) +Completed 200 OK in 90ms (Views: 40.7ms | ActiveRecord: 29.0ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:26:50 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.8ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + TodoListItem Load (0.5ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.1ms) + Rendered todo_lists/index.json.jbuilder (47.2ms) +Completed 200 OK in 90ms (Views: 26.0ms | ActiveRecord: 48.4ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:27:20 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (19.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + TodoListItem Load (0.7ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:1 + Rendered todo_lists/_todo_list.json.jbuilder (0.7ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.2ms) + Rendered todo_lists/index.json.jbuilder (54.5ms) +Completed 500 Internal Server Error in 100ms (ActiveRecord: 52.6ms) + + + +ActionView::Template::Error (Failed to add "page" property to an array): + 1: json.array! @todo_lists, partial: 'todo_lists/todo_list', as: :todo_list + 2: json.page @page + 3: json.size @size + +app/views/todo_lists/index.json.jbuilder:2:in `_app_views_todo_lists_index_json_jbuilder___1878044308550239634_70193277800440' +Started GET "/api/todos" for ::1 at 2019-04-28 15:28:44 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (16.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.6ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/_todo_list.json.jbuilder (0.7ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.2ms) + Rendered todo_lists/index.json.jbuilder (6.8ms) +Completed 500 Internal Server Error in 28ms (ActiveRecord: 17.2ms) + + + +ActionView::Template::Error (Can't merge [{"id"=>3, "title"=>"This is first ToDoList", "description"=>"Test", "list_items"=>[]}, {"id"=>1, "title"=>"This is first ToDoList - One", "description"=>"Test - 1", "list_items"=>[{"id"=>2, "title"=>"Sleep", "completed"=>true}]}] into {"page"=>1, "size"=>10}): + 1: json.page @page + 2: json.size @size + 3: + 4: json.array! @todo_lists, partial: 'todo_lists/todo_list', as: :todo_list + +app/views/todo_lists/index.json.jbuilder:4:in `_app_views_todo_lists_index_json_jbuilder___1878044308550239634_70193278092460' +Started GET "/api/todos" for ::1 at 2019-04-28 15:39:02 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (1.9ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/index.json.jbuilder (6.0ms) +Completed 200 OK in 11ms (Views: 4.4ms | ActiveRecord: 3.4ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:39:30 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.7ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (0.5ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/index.json.jbuilder (48.1ms) +Completed 200 OK in 72ms (Views: 40.9ms | ActiveRecord: 41.2ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:39:49 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (19.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + Rendered todo_lists/index.json.jbuilder (0.6ms) +Completed 500 Internal Server Error in 25ms (ActiveRecord: 19.8ms) + + + +SyntaxError (/Users/ajay/Documents/workspace/ruby/todoapis/app/views/todo_lists/index.json.jbuilder:5: syntax error, unexpected ':', expecting end + partial: 'todo_lists/todo_list', todo... + ^ +/Users/ajay/Documents/workspace/ruby/todoapis/app/views/todo_lists/index.json.jbuilder:5: syntax error, unexpected ',', expecting end +...artial: 'todo_lists/todo_list', todo_list: todo_list +... ^ +/Users/ajay/Documents/workspace/ruby/todoapis/app/views/todo_lists/index.json.jbuilder:11: syntax error, unexpected ensure, expecting end-of-input + ensure + ^~~~~~): + +app/views/todo_lists/index.json.jbuilder:5: syntax error, unexpected ':', expecting end +app/views/todo_lists/index.json.jbuilder:5: syntax error, unexpected ',', expecting end +app/views/todo_lists/index.json.jbuilder:11: syntax error, unexpected ensure, expecting end-of-input +Started GET "/api/todos" for ::1 at 2019-04-28 15:41:12 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.4ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 [["user_id", 2]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/_todo_list.json.jbuilder (0.7ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.2ms) + Rendered todo_lists/index.json.jbuilder (6.9ms) +Completed 200 OK in 14ms (Views: 9.2ms | ActiveRecord: 1.3ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:41:27 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (21.6ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (0.4ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.1ms) + Rendered todo_lists/index.json.jbuilder (54.1ms) +Completed 200 OK in 107ms (Views: 25.8ms | ActiveRecord: 57.3ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:41:32 +0530 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (6.0ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (2.0ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/_todo_list.json.jbuilder (0.6ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.2ms) + Rendered todo_lists/index.json.jbuilder (14.7ms) +Completed 200 OK in 20ms (Views: 8.1ms | ActiveRecord: 8.7ms) + + +Started GET "/api/todos" for ::1 at 2019-04-28 15:41:54 +0530 +  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC + ↳ /Users/ajay/.rvm/gems/ruby-2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98 +Processing by TodoListsController#index as JSON + Parameters: {"todo_list_item"=>{"title"=>"Sleep - 1"}, "todo_list"=>{}} + User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] + ↳ app/controllers/application_controller.rb:34 + Rendering todo_lists/index.json.jbuilder + TodoList Load (0.5ms) SELECT "todo_lists".* FROM "todo_lists" WHERE "todo_lists"."user_id" = $1 LIMIT $2 OFFSET $3 [["user_id", 2], ["LIMIT", 10], ["OFFSET", 0]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + TodoListItem Load (2.6ms) SELECT "todo_list_items".* FROM "todo_list_items" WHERE "todo_list_items"."todo_list_id" IN ($1, $2) [["todo_list_id", 3], ["todo_list_id", 1]] + ↳ app/views/todo_lists/index.json.jbuilder:4 + Rendered todo_lists/_todo_list.json.jbuilder (0.9ms) + Rendered todo_lists/_todo_list.json.jbuilder (0.5ms) + Rendered todo_lists/index.json.jbuilder (76.1ms) +Completed 200 OK in 124ms (Views: 45.2ms | ActiveRecord: 65.9ms) + + diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..37b576a --- /dev/null +++ b/public/robots.txt @@ -0,0 +1 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/storage/.keep b/storage/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/controllers/todo_list_items_controller_test.rb b/test/controllers/todo_list_items_controller_test.rb new file mode 100644 index 0000000..bf83064 --- /dev/null +++ b/test/controllers/todo_list_items_controller_test.rb @@ -0,0 +1,38 @@ +require 'test_helper' + +class TodoListItemsControllerTest < ActionDispatch::IntegrationTest + setup do + @todo_list_item = todo_list_items(:one) + end + + test "should get index" do + get todo_list_items_url, as: :json + assert_response :success + end + + test "should create todo_list_item" do + assert_difference('TodoListItem.count') do + post todo_list_items_url, params: { todo_list_item: { completed: @todo_list_item.completed, title: @todo_list_item.title, todo_list_id: @todo_list_item.todo_list_id } }, as: :json + end + + assert_response 201 + end + + test "should show todo_list_item" do + get todo_list_item_url(@todo_list_item), as: :json + assert_response :success + end + + test "should update todo_list_item" do + patch todo_list_item_url(@todo_list_item), params: { todo_list_item: { completed: @todo_list_item.completed, title: @todo_list_item.title, todo_list_id: @todo_list_item.todo_list_id } }, as: :json + assert_response 200 + end + + test "should destroy todo_list_item" do + assert_difference('TodoListItem.count', -1) do + delete todo_list_item_url(@todo_list_item), as: :json + end + + assert_response 204 + end +end diff --git a/test/controllers/todo_lists_controller_test.rb b/test/controllers/todo_lists_controller_test.rb new file mode 100644 index 0000000..81b8a90 --- /dev/null +++ b/test/controllers/todo_lists_controller_test.rb @@ -0,0 +1,38 @@ +require 'test_helper' + +class TodoListsControllerTest < ActionDispatch::IntegrationTest + setup do + @todo_list = todo_lists(:one) + end + + test "should get index" do + get todo_lists_url, as: :json + assert_response :success + end + + test "should create todo_list" do + assert_difference('TodoList.count') do + post todo_lists_url, params: { todo_list: { completed: @todo_list.completed, description: @todo_list.description, title: @todo_list.title } }, as: :json + end + + assert_response 201 + end + + test "should show todo_list" do + get todo_list_url(@todo_list), as: :json + assert_response :success + end + + test "should update todo_list" do + patch todo_list_url(@todo_list), params: { todo_list: { completed: @todo_list.completed, description: @todo_list.description, title: @todo_list.title } }, as: :json + assert_response 200 + end + + test "should destroy todo_list" do + assert_difference('TodoList.count', -1) do + delete todo_list_url(@todo_list), as: :json + end + + assert_response 204 + end +end diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/todo_list_items.yml b/test/fixtures/todo_list_items.yml new file mode 100644 index 0000000..058f1c0 --- /dev/null +++ b/test/fixtures/todo_list_items.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + todo_list_id: 1 + title: MyString + completed: false + +two: + todo_list_id: 1 + title: MyString + completed: false diff --git a/test/fixtures/todo_lists.yml b/test/fixtures/todo_lists.yml new file mode 100644 index 0000000..c2b3bc8 --- /dev/null +++ b/test/fixtures/todo_lists.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + description: MyText + completed: false + +two: + title: MyString + description: MyText + completed: false diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/todo_list_item_test.rb b/test/models/todo_list_item_test.rb new file mode 100644 index 0000000..5442542 --- /dev/null +++ b/test/models/todo_list_item_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TodoListItemTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/todo_list_test.rb b/test/models/todo_list_test.rb new file mode 100644 index 0000000..dd4ec26 --- /dev/null +++ b/test/models/todo_list_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TodoListTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..3ab84e3 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require_relative '../config/environment' +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/vendor/.keep b/vendor/.keep new file mode 100644 index 0000000..e69de29