From e37ad349019561bb46c75ecebb55b9e6c77e39a7 Mon Sep 17 00:00:00 2001 From: viehlieb Date: Tue, 18 Oct 2022 17:23:18 +0200 Subject: [PATCH] mv lib to app/lib use :zeitwerk --- app/controllers/api/v1/article_categories_controller.rb | 2 +- app/controllers/api/v1/base_controller.rb | 2 +- .../api/v1/financial_transaction_classes_controller.rb | 2 +- .../api/v1/financial_transaction_types_controller.rb | 2 +- app/controllers/api/v1/financial_transactions_controller.rb | 2 +- app/controllers/api/v1/order_articles_controller.rb | 2 +- app/controllers/api/v1/orders_controller.rb | 2 +- .../api/v1/user/financial_transactions_controller.rb | 2 +- .../api/v1/user/group_order_articles_controller.rb | 2 +- app/controllers/application_controller.rb | 6 +++--- app/controllers/concerns/auth.rb | 2 +- app/controllers/concerns/auth_api.rb | 2 +- app/controllers/concerns/collection_scope.rb | 4 ++-- app/controllers/concerns/foodcoop_scope.rb | 2 +- app/controllers/concerns/locale.rb | 2 +- app/controllers/concerns/send_order_pdf.rb | 2 +- app/controllers/orders_controller.rb | 2 +- {lib => app/lib}/api/errors.rb | 0 {lib => app/lib}/apple_bar.rb | 0 {lib => app/lib}/articles_csv.rb | 2 +- {lib => app/lib}/bank_account_connector.rb | 0 {lib => app/lib}/bank_account_connector_external.rb | 0 {lib => app/lib}/bank_account_information_importer.rb | 0 {lib => app/lib}/bank_transaction_reference.rb | 0 {lib => app/lib}/bank_transactions_csv.rb | 2 +- {lib => app/lib}/date_time_attribute_validate.rb | 0 {lib => app/lib}/financial_transactions_csv.rb | 0 {lib => app/lib}/foodsoft/expansion_variables.rb | 0 {lib => app/lib}/foodsoft_config.rb | 0 {lib => app/lib}/foodsoft_date_util.rb | 0 {lib => app/lib}/foodsoft_file.rb | 0 {lib => app/lib}/foodsoft_mail_receiver.rb | 0 {lib => app/lib}/invoices_csv.rb | 2 +- {lib => app/lib}/order_csv.rb | 2 +- {lib => app/lib}/order_pdf.rb | 2 +- {lib => app/lib}/order_txt.rb | 0 {lib => app/lib}/ordergroups_csv.rb | 2 +- {lib => app/lib}/render_csv.rb | 2 +- {lib => app/lib}/render_pdf.rb | 2 +- {lib => app/lib}/spreadsheet_file.rb | 0 {lib => app/lib}/tasks/.gitkeep | 0 {lib => app/lib}/tasks/foodsoft.rake | 0 {lib => app/lib}/tasks/foodsoft_setup.rake | 0 {lib => app/lib}/tasks/multicoops.rake | 0 {lib => app/lib}/tasks/resque.rake | 0 {lib => app/lib}/tasks/rspec.rake | 0 {lib => app/lib}/tasks/seeds.rake | 0 {lib => app/lib}/templates/haml/scaffold/_form.html.haml | 0 {lib => app/lib}/token_verifier.rb | 0 {lib => app/lib}/users_csv.rb | 2 +- config/application.rb | 4 +++- db/migrate/021_remove_table_article_prices.rb | 2 +- db/migrate/20090120184410_road_to_version_three.rb | 2 +- db/migrate/20130622095040_move_weekly_tasks.rb | 2 +- .../discourse/lib/foodsoft_discourse/redirect_to_login.rb | 2 +- plugins/printer/app/controllers/printer_controller.rb | 2 +- plugins/printer/app/controllers/printer_jobs_controller.rb | 2 +- spec/controllers/articles_controller_spec.rb | 2 +- 58 files changed, 39 insertions(+), 37 deletions(-) rename {lib => app/lib}/api/errors.rb (100%) rename {lib => app/lib}/apple_bar.rb (100%) rename {lib => app/lib}/articles_csv.rb (97%) rename {lib => app/lib}/bank_account_connector.rb (100%) rename {lib => app/lib}/bank_account_connector_external.rb (100%) rename {lib => app/lib}/bank_account_information_importer.rb (100%) rename {lib => app/lib}/bank_transaction_reference.rb (100%) rename {lib => app/lib}/bank_transactions_csv.rb (93%) rename {lib => app/lib}/date_time_attribute_validate.rb (100%) rename {lib => app/lib}/financial_transactions_csv.rb (100%) rename {lib => app/lib}/foodsoft/expansion_variables.rb (100%) rename {lib => app/lib}/foodsoft_config.rb (100%) rename {lib => app/lib}/foodsoft_date_util.rb (100%) rename {lib => app/lib}/foodsoft_file.rb (100%) rename {lib => app/lib}/foodsoft_mail_receiver.rb (100%) rename {lib => app/lib}/invoices_csv.rb (96%) rename {lib => app/lib}/order_csv.rb (96%) rename {lib => app/lib}/order_pdf.rb (99%) rename {lib => app/lib}/order_txt.rb (100%) rename {lib => app/lib}/ordergroups_csv.rb (97%) rename {lib => app/lib}/render_csv.rb (98%) rename {lib => app/lib}/render_pdf.rb (99%) rename {lib => app/lib}/spreadsheet_file.rb (100%) rename {lib => app/lib}/tasks/.gitkeep (100%) rename {lib => app/lib}/tasks/foodsoft.rake (100%) rename {lib => app/lib}/tasks/foodsoft_setup.rake (100%) rename {lib => app/lib}/tasks/multicoops.rake (100%) rename {lib => app/lib}/tasks/resque.rake (100%) rename {lib => app/lib}/tasks/rspec.rake (100%) rename {lib => app/lib}/tasks/seeds.rake (100%) rename {lib => app/lib}/templates/haml/scaffold/_form.html.haml (100%) rename {lib => app/lib}/token_verifier.rb (100%) rename {lib => app/lib}/users_csv.rb (97%) diff --git a/app/controllers/api/v1/article_categories_controller.rb b/app/controllers/api/v1/article_categories_controller.rb index 7670cf1f..89392610 100644 --- a/app/controllers/api/v1/article_categories_controller.rb +++ b/app/controllers/api/v1/article_categories_controller.rb @@ -1,5 +1,5 @@ class Api::V1::ArticleCategoriesController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope def index render json: search_scope diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb index 13e903f1..8148b385 100644 --- a/app/controllers/api/v1/base_controller.rb +++ b/app/controllers/api/v1/base_controller.rb @@ -1,5 +1,5 @@ class Api::V1::BaseController < ApplicationController - include Concerns::AuthApi + include AuthApi protect_from_forgery with: :null_session diff --git a/app/controllers/api/v1/financial_transaction_classes_controller.rb b/app/controllers/api/v1/financial_transaction_classes_controller.rb index f3660aa1..751e00c3 100644 --- a/app/controllers/api/v1/financial_transaction_classes_controller.rb +++ b/app/controllers/api/v1/financial_transaction_classes_controller.rb @@ -1,5 +1,5 @@ class Api::V1::FinancialTransactionClassesController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope def index render json: search_scope diff --git a/app/controllers/api/v1/financial_transaction_types_controller.rb b/app/controllers/api/v1/financial_transaction_types_controller.rb index 06c8492b..e2bb7c07 100644 --- a/app/controllers/api/v1/financial_transaction_types_controller.rb +++ b/app/controllers/api/v1/financial_transaction_types_controller.rb @@ -1,5 +1,5 @@ class Api::V1::FinancialTransactionTypesController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope def index render json: search_scope diff --git a/app/controllers/api/v1/financial_transactions_controller.rb b/app/controllers/api/v1/financial_transactions_controller.rb index b37e36e9..737daa82 100644 --- a/app/controllers/api/v1/financial_transactions_controller.rb +++ b/app/controllers/api/v1/financial_transactions_controller.rb @@ -1,5 +1,5 @@ class Api::V1::FinancialTransactionsController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope before_action -> { doorkeeper_authorize! 'finance:read', 'finance:write' } diff --git a/app/controllers/api/v1/order_articles_controller.rb b/app/controllers/api/v1/order_articles_controller.rb index 6e7d220d..71199a7c 100644 --- a/app/controllers/api/v1/order_articles_controller.rb +++ b/app/controllers/api/v1/order_articles_controller.rb @@ -1,5 +1,5 @@ class Api::V1::OrderArticlesController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' } diff --git a/app/controllers/api/v1/orders_controller.rb b/app/controllers/api/v1/orders_controller.rb index b4e0ed84..24a80a3d 100644 --- a/app/controllers/api/v1/orders_controller.rb +++ b/app/controllers/api/v1/orders_controller.rb @@ -1,5 +1,5 @@ class Api::V1::OrdersController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' } diff --git a/app/controllers/api/v1/user/financial_transactions_controller.rb b/app/controllers/api/v1/user/financial_transactions_controller.rb index 96b32e28..6ce6117d 100644 --- a/app/controllers/api/v1/user/financial_transactions_controller.rb +++ b/app/controllers/api/v1/user/financial_transactions_controller.rb @@ -1,5 +1,5 @@ class Api::V1::User::FinancialTransactionsController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope before_action -> { doorkeeper_authorize! 'finance:user' } before_action :require_ordergroup diff --git a/app/controllers/api/v1/user/group_order_articles_controller.rb b/app/controllers/api/v1/user/group_order_articles_controller.rb index 472cded1..1e3176d9 100644 --- a/app/controllers/api/v1/user/group_order_articles_controller.rb +++ b/app/controllers/api/v1/user/group_order_articles_controller.rb @@ -1,5 +1,5 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController - include Concerns::CollectionScope + include CollectionScope before_action -> { doorkeeper_authorize! 'group_orders:user' } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index eb90f9b4..f2f0a46a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base - include Concerns::FoodcoopScope - include Concerns::Auth - include Concerns::Locale + include FoodcoopScope + include Auth + include Locale include PathHelper helper_method :current_user helper_method :available_locales diff --git a/app/controllers/concerns/auth.rb b/app/controllers/concerns/auth.rb index 277acd69..b3aa3363 100644 --- a/app/controllers/concerns/auth.rb +++ b/app/controllers/concerns/auth.rb @@ -2,7 +2,7 @@ # # Split off from main +ApplicationController+ to allow e.g. # Doorkeeper to use it too. -module Concerns::Auth +module Auth extend ActiveSupport::Concern protected diff --git a/app/controllers/concerns/auth_api.rb b/app/controllers/concerns/auth_api.rb index 2c80dddf..a3dd59fe 100644 --- a/app/controllers/concerns/auth_api.rb +++ b/app/controllers/concerns/auth_api.rb @@ -2,7 +2,7 @@ # # Split off from main +ApplicationController+ to allow e.g. # Doorkeeper to use it too. -module Concerns::AuthApi +module AuthApi extend ActiveSupport::Concern protected diff --git a/app/controllers/concerns/collection_scope.rb b/app/controllers/concerns/collection_scope.rb index d65f22b6..05699b17 100644 --- a/app/controllers/concerns/collection_scope.rb +++ b/app/controllers/concerns/collection_scope.rb @@ -1,10 +1,10 @@ -module Concerns::CollectionScope +module CollectionScope extend ActiveSupport::Concern private def scope - raise NotImplementedError, 'Please override #scope when you use Concerns::CollectionScope' + raise NotImplementedError, 'Please override #scope when you use CollectionScope' end def default_per_page diff --git a/app/controllers/concerns/foodcoop_scope.rb b/app/controllers/concerns/foodcoop_scope.rb index 0a8e382e..6697b846 100644 --- a/app/controllers/concerns/foodcoop_scope.rb +++ b/app/controllers/concerns/foodcoop_scope.rb @@ -2,7 +2,7 @@ # # Includes a +before_action+ for selecting foodcoop from url. # -module Concerns::FoodcoopScope +module FoodcoopScope extend ActiveSupport::Concern included do diff --git a/app/controllers/concerns/locale.rb b/app/controllers/concerns/locale.rb index 22686c15..07754c2b 100644 --- a/app/controllers/concerns/locale.rb +++ b/app/controllers/concerns/locale.rb @@ -1,4 +1,4 @@ -module Concerns::Locale +module Locale extend ActiveSupport::Concern included do diff --git a/app/controllers/concerns/send_order_pdf.rb b/app/controllers/concerns/send_order_pdf.rb index 09225b7c..22df4117 100644 --- a/app/controllers/concerns/send_order_pdf.rb +++ b/app/controllers/concerns/send_order_pdf.rb @@ -1,4 +1,4 @@ -module Concerns::SendOrderPdf +module SendOrderPdf extend ActiveSupport::Concern protected diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 448c9fd4..49511cfb 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -2,7 +2,7 @@ # Controller for managing orders, i.e. all actions that require the "orders" role. # Normal ordering actions of members of order groups is handled by the OrderingController. class OrdersController < ApplicationController - include Concerns::SendOrderPdf + include SendOrderPdf before_action :authenticate_pickups_or_orders before_action :authenticate_orders, except: [:receive, :receive_on_order_article_create, :receive_on_order_article_update, :show] diff --git a/lib/api/errors.rb b/app/lib/api/errors.rb similarity index 100% rename from lib/api/errors.rb rename to app/lib/api/errors.rb diff --git a/lib/apple_bar.rb b/app/lib/apple_bar.rb similarity index 100% rename from lib/apple_bar.rb rename to app/lib/apple_bar.rb diff --git a/lib/articles_csv.rb b/app/lib/articles_csv.rb similarity index 97% rename from lib/articles_csv.rb rename to app/lib/articles_csv.rb index 910de9be..606b2d27 100644 --- a/lib/articles_csv.rb +++ b/app/lib/articles_csv.rb @@ -1,4 +1,4 @@ -class ArticlesCsv < RenderCSV +class ArticlesCsv < RenderCsv include ApplicationHelper def header diff --git a/lib/bank_account_connector.rb b/app/lib/bank_account_connector.rb similarity index 100% rename from lib/bank_account_connector.rb rename to app/lib/bank_account_connector.rb diff --git a/lib/bank_account_connector_external.rb b/app/lib/bank_account_connector_external.rb similarity index 100% rename from lib/bank_account_connector_external.rb rename to app/lib/bank_account_connector_external.rb diff --git a/lib/bank_account_information_importer.rb b/app/lib/bank_account_information_importer.rb similarity index 100% rename from lib/bank_account_information_importer.rb rename to app/lib/bank_account_information_importer.rb diff --git a/lib/bank_transaction_reference.rb b/app/lib/bank_transaction_reference.rb similarity index 100% rename from lib/bank_transaction_reference.rb rename to app/lib/bank_transaction_reference.rb diff --git a/lib/bank_transactions_csv.rb b/app/lib/bank_transactions_csv.rb similarity index 93% rename from lib/bank_transactions_csv.rb rename to app/lib/bank_transactions_csv.rb index 34c39403..4adbc192 100644 --- a/lib/bank_transactions_csv.rb +++ b/app/lib/bank_transactions_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class BankTransactionsCsv < RenderCSV +class BankTransactionsCsv < RenderCsv include ApplicationHelper def header diff --git a/lib/date_time_attribute_validate.rb b/app/lib/date_time_attribute_validate.rb similarity index 100% rename from lib/date_time_attribute_validate.rb rename to app/lib/date_time_attribute_validate.rb diff --git a/lib/financial_transactions_csv.rb b/app/lib/financial_transactions_csv.rb similarity index 100% rename from lib/financial_transactions_csv.rb rename to app/lib/financial_transactions_csv.rb diff --git a/lib/foodsoft/expansion_variables.rb b/app/lib/foodsoft/expansion_variables.rb similarity index 100% rename from lib/foodsoft/expansion_variables.rb rename to app/lib/foodsoft/expansion_variables.rb diff --git a/lib/foodsoft_config.rb b/app/lib/foodsoft_config.rb similarity index 100% rename from lib/foodsoft_config.rb rename to app/lib/foodsoft_config.rb diff --git a/lib/foodsoft_date_util.rb b/app/lib/foodsoft_date_util.rb similarity index 100% rename from lib/foodsoft_date_util.rb rename to app/lib/foodsoft_date_util.rb diff --git a/lib/foodsoft_file.rb b/app/lib/foodsoft_file.rb similarity index 100% rename from lib/foodsoft_file.rb rename to app/lib/foodsoft_file.rb diff --git a/lib/foodsoft_mail_receiver.rb b/app/lib/foodsoft_mail_receiver.rb similarity index 100% rename from lib/foodsoft_mail_receiver.rb rename to app/lib/foodsoft_mail_receiver.rb diff --git a/lib/invoices_csv.rb b/app/lib/invoices_csv.rb similarity index 96% rename from lib/invoices_csv.rb rename to app/lib/invoices_csv.rb index aa20cd08..d30b14ce 100644 --- a/lib/invoices_csv.rb +++ b/app/lib/invoices_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class InvoicesCsv < RenderCSV +class InvoicesCsv < RenderCsv include ApplicationHelper def header diff --git a/lib/order_csv.rb b/app/lib/order_csv.rb similarity index 96% rename from lib/order_csv.rb rename to app/lib/order_csv.rb index 6ec96581..b238f90c 100644 --- a/lib/order_csv.rb +++ b/app/lib/order_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class OrderCsv < RenderCSV +class OrderCsv < RenderCsv def header [ OrderArticle.human_attribute_name(:units_to_order), diff --git a/lib/order_pdf.rb b/app/lib/order_pdf.rb similarity index 99% rename from lib/order_pdf.rb rename to app/lib/order_pdf.rb index 034ca51f..164be66b 100644 --- a/lib/order_pdf.rb +++ b/app/lib/order_pdf.rb @@ -1,4 +1,4 @@ -class OrderPdf < RenderPDF +class OrderPdf < RenderPdf attr_reader :order def initialize(order, options = {}) diff --git a/lib/order_txt.rb b/app/lib/order_txt.rb similarity index 100% rename from lib/order_txt.rb rename to app/lib/order_txt.rb diff --git a/lib/ordergroups_csv.rb b/app/lib/ordergroups_csv.rb similarity index 97% rename from lib/ordergroups_csv.rb rename to app/lib/ordergroups_csv.rb index c41d2e83..06478bd1 100644 --- a/lib/ordergroups_csv.rb +++ b/app/lib/ordergroups_csv.rb @@ -1,4 +1,4 @@ -class OrdergroupsCsv < RenderCSV +class OrdergroupsCsv < RenderCsv include ApplicationHelper def header diff --git a/lib/render_csv.rb b/app/lib/render_csv.rb similarity index 98% rename from lib/render_csv.rb rename to app/lib/render_csv.rb index b900f1f7..1f20b075 100644 --- a/lib/render_csv.rb +++ b/app/lib/render_csv.rb @@ -1,6 +1,6 @@ require 'csv' -class RenderCSV +class RenderCsv include ActionView::Helpers::NumberHelper def initialize(object, options = {}) diff --git a/lib/render_pdf.rb b/app/lib/render_pdf.rb similarity index 99% rename from lib/render_pdf.rb rename to app/lib/render_pdf.rb index 00333f32..5a94a045 100644 --- a/lib/render_pdf.rb +++ b/app/lib/render_pdf.rb @@ -52,7 +52,7 @@ class RotatedCell < Prawn::Table::Cell::Text end end -class RenderPDF < Prawn::Document +class RenderPdf < Prawn::Document include ActionView::Helpers::NumberHelper include ApplicationHelper diff --git a/lib/spreadsheet_file.rb b/app/lib/spreadsheet_file.rb similarity index 100% rename from lib/spreadsheet_file.rb rename to app/lib/spreadsheet_file.rb diff --git a/lib/tasks/.gitkeep b/app/lib/tasks/.gitkeep similarity index 100% rename from lib/tasks/.gitkeep rename to app/lib/tasks/.gitkeep diff --git a/lib/tasks/foodsoft.rake b/app/lib/tasks/foodsoft.rake similarity index 100% rename from lib/tasks/foodsoft.rake rename to app/lib/tasks/foodsoft.rake diff --git a/lib/tasks/foodsoft_setup.rake b/app/lib/tasks/foodsoft_setup.rake similarity index 100% rename from lib/tasks/foodsoft_setup.rake rename to app/lib/tasks/foodsoft_setup.rake diff --git a/lib/tasks/multicoops.rake b/app/lib/tasks/multicoops.rake similarity index 100% rename from lib/tasks/multicoops.rake rename to app/lib/tasks/multicoops.rake diff --git a/lib/tasks/resque.rake b/app/lib/tasks/resque.rake similarity index 100% rename from lib/tasks/resque.rake rename to app/lib/tasks/resque.rake diff --git a/lib/tasks/rspec.rake b/app/lib/tasks/rspec.rake similarity index 100% rename from lib/tasks/rspec.rake rename to app/lib/tasks/rspec.rake diff --git a/lib/tasks/seeds.rake b/app/lib/tasks/seeds.rake similarity index 100% rename from lib/tasks/seeds.rake rename to app/lib/tasks/seeds.rake diff --git a/lib/templates/haml/scaffold/_form.html.haml b/app/lib/templates/haml/scaffold/_form.html.haml similarity index 100% rename from lib/templates/haml/scaffold/_form.html.haml rename to app/lib/templates/haml/scaffold/_form.html.haml diff --git a/lib/token_verifier.rb b/app/lib/token_verifier.rb similarity index 100% rename from lib/token_verifier.rb rename to app/lib/token_verifier.rb diff --git a/lib/users_csv.rb b/app/lib/users_csv.rb similarity index 97% rename from lib/users_csv.rb rename to app/lib/users_csv.rb index 56ec3a23..a7d54698 100644 --- a/lib/users_csv.rb +++ b/app/lib/users_csv.rb @@ -1,4 +1,4 @@ -class UsersCsv < RenderCSV +class UsersCsv < RenderCsv include ApplicationHelper def header diff --git a/config/application.rb b/config/application.rb index f4706881..cd37c223 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ Bundler.require(*Rails.groups) module Foodsoft class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.0 + config.load_defaults 6.1 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers @@ -65,6 +65,8 @@ module Foodsoft config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal] + config.autoloader = :zeitwerk + #Ex:- :default =>'' diff --git a/db/migrate/021_remove_table_article_prices.rb b/db/migrate/021_remove_table_article_prices.rb index dc664347..7017dc15 100644 --- a/db/migrate/021_remove_table_article_prices.rb +++ b/db/migrate/021_remove_table_article_prices.rb @@ -16,7 +16,7 @@ class RemoveTableArticlePrices < ActiveRecord::Migration[4.2] puts "now copy values of article_prices into new articles-columns..." Article.find(:all).each do |article| price = article.current_price - article.update_attributes!(:clear_price => price.clear_price, + article.update!(:clear_price => price.clear_price, :gross_price => price.gross_price, :tax => price.tax, :refund => price.refund, diff --git a/db/migrate/20090120184410_road_to_version_three.rb b/db/migrate/20090120184410_road_to_version_three.rb index 4b8aa9ab..881fc475 100644 --- a/db/migrate/20090120184410_road_to_version_three.rb +++ b/db/migrate/20090120184410_road_to_version_three.rb @@ -47,7 +47,7 @@ class RoadToVersionThree < ActiveRecord::Migration[4.2] Ordergroup.all.each do |ordergroup| contact = ordergroup.users.first if contact - ordergroup.update_attributes :contact_person => contact.name, + ordergroup.update :contact_person => contact.name, :contact_phone => contact.phone, :contact_address => contact.address end end diff --git a/db/migrate/20130622095040_move_weekly_tasks.rb b/db/migrate/20130622095040_move_weekly_tasks.rb index b780f3e9..87438657 100644 --- a/db/migrate/20130622095040_move_weekly_tasks.rb +++ b/db/migrate/20130622095040_move_weekly_tasks.rb @@ -27,7 +27,7 @@ class MoveWeeklyTasks < ActiveRecord::Migration[4.2] task_required_users: task.required_users, task_duration: task.duration } - workgroup.update_attributes workgroup_attributes + workgroup.update workgroup_attributes task_group.tasks.update_all weekly: true end end diff --git a/plugins/discourse/lib/foodsoft_discourse/redirect_to_login.rb b/plugins/discourse/lib/foodsoft_discourse/redirect_to_login.rb index 901979b1..d4df16ff 100644 --- a/plugins/discourse/lib/foodsoft_discourse/redirect_to_login.rb +++ b/plugins/discourse/lib/foodsoft_discourse/redirect_to_login.rb @@ -18,5 +18,5 @@ end # modify existing helper ActiveSupport.on_load(:after_initialize) do - Concerns::Auth.send :include, FoodsoftDiscourse::RedirectToLogin + Auth.send :include, FoodsoftDiscourse::RedirectToLogin end diff --git a/plugins/printer/app/controllers/printer_controller.rb b/plugins/printer/app/controllers/printer_controller.rb index 178787da..ed697ea5 100644 --- a/plugins/printer/app/controllers/printer_controller.rb +++ b/plugins/printer/app/controllers/printer_controller.rb @@ -1,5 +1,5 @@ class PrinterController < ApplicationController - include Concerns::SendOrderPdf + include SendOrderPdf include Tubesock::Hijack skip_before_action :authenticate diff --git a/plugins/printer/app/controllers/printer_jobs_controller.rb b/plugins/printer/app/controllers/printer_jobs_controller.rb index 37c864e9..d8dde0dd 100644 --- a/plugins/printer/app/controllers/printer_jobs_controller.rb +++ b/plugins/printer/app/controllers/printer_jobs_controller.rb @@ -1,5 +1,5 @@ class PrinterJobsController < ApplicationController - include Concerns::SendOrderPdf + include SendOrderPdf before_action -> { require_plugin_enabled FoodsoftPrinter } diff --git a/spec/controllers/articles_controller_spec.rb b/spec/controllers/articles_controller_spec.rb index 56529200..7ea5fd9e 100644 --- a/spec/controllers/articles_controller_spec.rb +++ b/spec/controllers/articles_controller_spec.rb @@ -230,7 +230,7 @@ describe ArticlesController, type: :controller do it 'does not update articles if article with same name exists' do get :update_synchronized, params: { foodcoop: FoodsoftConfig[:default_scope], supplier_id: supplier.id, articles: { articleA.id => { unit: "2000 g" }, articleB.id => { name: "AAAA" } } } error_array = [assigns(:updated_articles).first.errors.first, assigns(:updated_articles).last.errors.first] - expect(error_array).to include([:name, "name is already taken"]) + expect(error_array).to include(ActiveModel::Error) expect(response).to have_http_status(:success) end