From 33184af8b3acf0b98a49568fcfde14d685d9f326 Mon Sep 17 00:00:00 2001 From: tl3ilaxu Date: Tue, 8 Mar 2016 15:53:50 +0100 Subject: [PATCH] Add literally all the annotation --- app/controllers/barcodes_controller.rb | 11 ++++++++++ app/controllers/orders_controller.rb | 12 +++++++++++ app/controllers/products_controller.rb | 19 +++++++++++++++++ app/controllers/users_controller.rb | 22 ++++++++++++++++++++ app/helpers/products_helper.rb | 19 +++++++++++++++++ app/models/order_item.rb | 2 +- app/models/product.rb | 8 +++---- app/models/user.rb | 11 +++++----- spec/controllers/barcodes_controller_spec.rb | 11 ++++++++++ spec/controllers/products_controller_spec.rb | 19 +++++++++++++++++ spec/controllers/users_controller_spec.rb | 22 ++++++++++++++++++++ spec/factories/order_items.rb | 2 +- spec/factories/products.rb | 8 +++---- spec/factories/users.rb | 11 +++++----- spec/models/order_item_spec.rb | 2 +- spec/models/product_spec.rb | 8 +++---- spec/models/user_spec.rb | 11 +++++----- 17 files changed, 168 insertions(+), 30 deletions(-) diff --git a/app/controllers/barcodes_controller.rb b/app/controllers/barcodes_controller.rb index f8c7ed2..3f61f50 100644 --- a/app/controllers/barcodes_controller.rb +++ b/app/controllers/barcodes_controller.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: barcodes +# +# id :integer not null, primary key +# product_id :integer +# code :string default(""), not null +# created_at :datetime +# updated_at :datetime +# + class BarcodesController < ApplicationController load_and_authorize_resource :product, only: :create load_and_authorize_resource :barcode, through: :product, shallow: true diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 6589a89..3b56533 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: orders +# +# id :integer not null, primary key +# user_id :integer +# price_cents :integer +# created_at :datetime not null +# updated_at :datetime not null +# transaction_id :integer +# + class OrdersController < ApplicationController load_resource :user load_and_authorize_resource :order, through: :user, shallow: true, only: [:overview, :destroy] diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index d2f2874..9504241 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -1,3 +1,22 @@ +# == Schema Information +# +# Table name: products +# +# id :integer not null, primary key +# name :string not null +# price_cents :integer default(0), not null +# created_at :datetime +# updated_at :datetime +# avatar_file_name :string +# avatar_content_type :string +# avatar_file_size :integer +# avatar_updated_at :datetime +# category :integer default(0) +# stock :integer default(0), not null +# calories :integer +# deleted :boolean default(FALSE) +# + class ProductsController < ApplicationController load_and_authorize_resource diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4ab9d5f..45963ed 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,3 +1,25 @@ +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# created_at :datetime +# updated_at :datetime +# remember_created_at :datetime +# admin :boolean default(FALSE) +# dagschotel_id :integer +# avatar_file_name :string +# avatar_content_type :string +# avatar_file_size :integer +# avatar_updated_at :datetime +# orders_count :integer default(0) +# koelkast :boolean default(FALSE) +# name :string +# private :boolean default(FALSE) +# frecency :integer default(0), not null +# quickpay_hidden :boolean +# + class UsersController < ApplicationController load_and_authorize_resource before_action :init, only: :show diff --git a/app/helpers/products_helper.rb b/app/helpers/products_helper.rb index 87d5bd7..7b5ab1d 100644 --- a/app/helpers/products_helper.rb +++ b/app/helpers/products_helper.rb @@ -1,3 +1,22 @@ +# == Schema Information +# +# Table name: products +# +# id :integer not null, primary key +# name :string not null +# price_cents :integer default(0), not null +# created_at :datetime +# updated_at :datetime +# avatar_file_name :string +# avatar_content_type :string +# avatar_file_size :integer +# avatar_updated_at :datetime +# category :integer default(0) +# stock :integer default(0), not null +# calories :integer +# deleted :boolean default(FALSE) +# + module ProductsHelper def kcal(calories) calories.to_s + " kcal" diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 3946f84..6680b7f 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -5,7 +5,7 @@ # id :integer not null, primary key # order_id :integer # product_id :integer not null -# count :integer default("0") +# count :integer default(0) # class OrderItem < ActiveRecord::Base diff --git a/app/models/product.rb b/app/models/product.rb index 497f64a..2a92f8a 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -4,17 +4,17 @@ # # id :integer not null, primary key # name :string not null -# price_cents :integer default("0"), not null +# price_cents :integer default(0), not null # created_at :datetime # updated_at :datetime # avatar_file_name :string # avatar_content_type :string # avatar_file_size :integer # avatar_updated_at :datetime -# category :integer default("0") -# stock :integer default("0"), not null +# category :integer default(0) +# stock :integer default(0), not null # calories :integer -# deleted :boolean default("f") +# deleted :boolean default(FALSE) # class Product < ActiveRecord::Base diff --git a/app/models/user.rb b/app/models/user.rb index 6b41bc8..7bfd2e2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,17 +6,18 @@ # created_at :datetime # updated_at :datetime # remember_created_at :datetime -# admin :boolean +# admin :boolean default(FALSE) # dagschotel_id :integer # avatar_file_name :string # avatar_content_type :string # avatar_file_size :integer # avatar_updated_at :datetime -# orders_count :integer default("0") -# koelkast :boolean default("f") +# orders_count :integer default(0) +# koelkast :boolean default(FALSE) # name :string -# encrypted_password :string default(""), not null -# private :boolean default("f") +# private :boolean default(FALSE) +# frecency :integer default(0), not null +# quickpay_hidden :boolean # class User < ActiveRecord::Base diff --git a/spec/controllers/barcodes_controller_spec.rb b/spec/controllers/barcodes_controller_spec.rb index 90c10c9..25c779c 100644 --- a/spec/controllers/barcodes_controller_spec.rb +++ b/spec/controllers/barcodes_controller_spec.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: barcodes +# +# id :integer not null, primary key +# product_id :integer +# code :string default(""), not null +# created_at :datetime +# updated_at :datetime +# + # product_barcodes POST /products/:product_id/barcodes(.:format) barcodes#create # barcodes GET /barcodes(.:format) barcodes#index # barcode GET /barcodes/:id(.:format) barcodes#show diff --git a/spec/controllers/products_controller_spec.rb b/spec/controllers/products_controller_spec.rb index ff9e416..cff363a 100644 --- a/spec/controllers/products_controller_spec.rb +++ b/spec/controllers/products_controller_spec.rb @@ -1,3 +1,22 @@ +# == Schema Information +# +# Table name: products +# +# id :integer not null, primary key +# name :string not null +# price_cents :integer default(0), not null +# created_at :datetime +# updated_at :datetime +# avatar_file_name :string +# avatar_content_type :string +# avatar_file_size :integer +# avatar_updated_at :datetime +# category :integer default(0) +# stock :integer default(0), not null +# calories :integer +# deleted :boolean default(FALSE) +# + # barcode_products GET /products/barcode(.:format) products#barcode # load_barcode_products POST /products/barcode(.:format) products#load_barcode # products GET /products(.:format) products#index diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index f3d316c..1b00265 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,3 +1,25 @@ +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# created_at :datetime +# updated_at :datetime +# remember_created_at :datetime +# admin :boolean default(FALSE) +# dagschotel_id :integer +# avatar_file_name :string +# avatar_content_type :string +# avatar_file_size :integer +# avatar_updated_at :datetime +# orders_count :integer default(0) +# koelkast :boolean default(FALSE) +# name :string +# private :boolean default(FALSE) +# frecency :integer default(0), not null +# quickpay_hidden :boolean +# + # quickpay_user GET /users/:id/quickpay(.:format) users#quickpay # edit_dagschotel_user GET /users/:id/dagschotel/edit(.:format) users#edit_dagschotel # edit_user GET /users/:id/edit(.:format) users#edit diff --git a/spec/factories/order_items.rb b/spec/factories/order_items.rb index 32acb2e..dc993f0 100644 --- a/spec/factories/order_items.rb +++ b/spec/factories/order_items.rb @@ -5,7 +5,7 @@ # id :integer not null, primary key # order_id :integer # product_id :integer not null -# count :integer default("0") +# count :integer default(0) # FactoryGirl.define do diff --git a/spec/factories/products.rb b/spec/factories/products.rb index 16dfb06..bba73ea 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -4,17 +4,17 @@ # # id :integer not null, primary key # name :string not null -# price_cents :integer default("0"), not null +# price_cents :integer default(0), not null # created_at :datetime # updated_at :datetime # avatar_file_name :string # avatar_content_type :string # avatar_file_size :integer # avatar_updated_at :datetime -# category :integer default("0") -# stock :integer default("0"), not null +# category :integer default(0) +# stock :integer default(0), not null # calories :integer -# deleted :boolean default("f") +# deleted :boolean default(FALSE) # require 'faker' diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 1df99aa..8949be0 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -6,17 +6,18 @@ # created_at :datetime # updated_at :datetime # remember_created_at :datetime -# admin :boolean +# admin :boolean default(FALSE) # dagschotel_id :integer # avatar_file_name :string # avatar_content_type :string # avatar_file_size :integer # avatar_updated_at :datetime -# orders_count :integer default("0") -# koelkast :boolean default("f") +# orders_count :integer default(0) +# koelkast :boolean default(FALSE) # name :string -# encrypted_password :string default(""), not null -# private :boolean default("f") +# private :boolean default(FALSE) +# frecency :integer default(0), not null +# quickpay_hidden :boolean # require 'faker' diff --git a/spec/models/order_item_spec.rb b/spec/models/order_item_spec.rb index 73b3fe6..37c8da3 100644 --- a/spec/models/order_item_spec.rb +++ b/spec/models/order_item_spec.rb @@ -5,7 +5,7 @@ # id :integer not null, primary key # order_id :integer # product_id :integer not null -# count :integer default("0") +# count :integer default(0) # describe OrderItem do diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index abf6e74..0ea4ccb 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -4,17 +4,17 @@ # # id :integer not null, primary key # name :string not null -# price_cents :integer default("0"), not null +# price_cents :integer default(0), not null # created_at :datetime # updated_at :datetime # avatar_file_name :string # avatar_content_type :string # avatar_file_size :integer # avatar_updated_at :datetime -# category :integer default("0") -# stock :integer default("0"), not null +# category :integer default(0) +# stock :integer default(0), not null # calories :integer -# deleted :boolean default("f") +# deleted :boolean default(FALSE) # describe Product do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2df74c7..cc3b8af 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -6,17 +6,18 @@ # created_at :datetime # updated_at :datetime # remember_created_at :datetime -# admin :boolean +# admin :boolean default(FALSE) # dagschotel_id :integer # avatar_file_name :string # avatar_content_type :string # avatar_file_size :integer # avatar_updated_at :datetime -# orders_count :integer default("0") -# koelkast :boolean default("f") +# orders_count :integer default(0) +# koelkast :boolean default(FALSE) # name :string -# encrypted_password :string default(""), not null -# private :boolean default("f") +# private :boolean default(FALSE) +# frecency :integer default(0), not null +# quickpay_hidden :boolean # require 'webmock/rspec'