diff --git a/app/controllers/admin/column_preferences_controller.rb b/app/controllers/admin/column_preferences_controller.rb index ee21a14131..49e4bf90a5 100644 --- a/app/controllers/admin/column_preferences_controller.rb +++ b/app/controllers/admin/column_preferences_controller.rb @@ -1,6 +1,6 @@ module Admin class ColumnPreferencesController < ResourceController - before_filter :load_collection, only: [:bulk_update] + before_action :load_collection, only: [:bulk_update] respond_to :json diff --git a/app/controllers/admin/customers_controller.rb b/app/controllers/admin/customers_controller.rb index 667c62aad0..c79811ab2e 100644 --- a/app/controllers/admin/customers_controller.rb +++ b/app/controllers/admin/customers_controller.rb @@ -2,7 +2,7 @@ require 'open_food_network/address_finder' module Admin class CustomersController < ResourceController - before_filter :load_managed_shops, only: :index, if: :html_request? + before_action :load_managed_shops, only: :index, if: :html_request? respond_to :json respond_override update: { json: { diff --git a/app/controllers/admin/enterprise_fees_controller.rb b/app/controllers/admin/enterprise_fees_controller.rb index 47372fa5f4..56187450a7 100644 --- a/app/controllers/admin/enterprise_fees_controller.rb +++ b/app/controllers/admin/enterprise_fees_controller.rb @@ -1,7 +1,7 @@ module Admin class EnterpriseFeesController < ResourceController - before_filter :load_enterprise_fee_set, only: :index - before_filter :load_data + before_action :load_enterprise_fee_set, only: :index + before_action :load_data def index @include_calculators = params[:include_calculators].present? diff --git a/app/controllers/admin/enterprise_groups_controller.rb b/app/controllers/admin/enterprise_groups_controller.rb index 471d56d5ab..9d5bc6c665 100644 --- a/app/controllers/admin/enterprise_groups_controller.rb +++ b/app/controllers/admin/enterprise_groups_controller.rb @@ -1,7 +1,7 @@ module Admin class EnterpriseGroupsController < ResourceController - before_filter :load_data, except: :index - before_filter :load_object_data, only: [:new, :edit, :create, :update] + before_action :load_data, except: :index + before_action :load_object_data, only: [:new, :edit, :create, :update] def index @enterprise_groups = @enterprise_groups.managed_by(spree_current_user) diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index 8b8901e211..479896f0b1 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -5,22 +5,22 @@ require 'open_food_network/order_cycle_permissions' module Admin class EnterprisesController < ResourceController # These need to run before #load_resource so that @object is initialised with sanitised values - prepend_before_filter :override_owner, only: :create - prepend_before_filter :override_sells, only: :create + prepend_before_action :override_owner, only: :create + prepend_before_action :override_sells, only: :create - before_filter :load_enterprise_set, only: :index - before_filter :load_countries, except: [:index, :register, :check_permalink] - before_filter :load_methods_and_fees, only: [:edit, :update] - before_filter :load_groups, only: [:new, :edit, :update, :create] - before_filter :load_taxons, only: [:new, :edit, :update, :create] - before_filter :check_can_change_sells, only: :update - before_filter :check_can_change_bulk_sells, only: :bulk_update - before_filter :check_can_change_owner, only: :update - before_filter :check_can_change_bulk_owner, only: :bulk_update - before_filter :check_can_change_managers, only: :update - before_filter :strip_new_properties, only: [:create, :update] - before_filter :load_properties, only: [:edit, :update] - before_filter :setup_property, only: [:edit] + before_action :load_enterprise_set, only: :index + before_action :load_countries, except: [:index, :register, :check_permalink] + before_action :load_methods_and_fees, only: [:edit, :update] + before_action :load_groups, only: [:new, :edit, :update, :create] + before_action :load_taxons, only: [:new, :edit, :update, :create] + before_action :check_can_change_sells, only: :update + before_action :check_can_change_bulk_sells, only: :bulk_update + before_action :check_can_change_owner, only: :update + before_action :check_can_change_bulk_owner, only: :bulk_update + before_action :check_can_change_managers, only: :update + before_action :strip_new_properties, only: [:create, :update] + before_action :load_properties, only: [:edit, :update] + before_action :setup_property, only: [:edit] helper 'spree/products' include OrderCyclesHelper diff --git a/app/controllers/admin/order_cycles_controller.rb b/app/controllers/admin/order_cycles_controller.rb index 8b488c8bda..4441403ef0 100644 --- a/app/controllers/admin/order_cycles_controller.rb +++ b/app/controllers/admin/order_cycles_controller.rb @@ -2,12 +2,12 @@ module Admin class OrderCyclesController < ResourceController include OrderCyclesHelper - prepend_before_filter :set_order_cycle_id, only: [:incoming, :outgoing] - before_filter :load_data_for_index, only: :index - before_filter :require_coordinator, only: :new - before_filter :remove_protected_attrs, only: [:update] - before_filter :require_order_cycle_set_params, only: [:bulk_update] - around_filter :protect_invalid_destroy, only: :destroy + prepend_before_action :set_order_cycle_id, only: [:incoming, :outgoing] + before_action :load_data_for_index, only: :index + before_action :require_coordinator, only: :new + before_action :remove_protected_attrs, only: [:update] + before_action :require_order_cycle_set_params, only: [:bulk_update] + around_action :protect_invalid_destroy, only: :destroy def index respond_to do |format| diff --git a/app/controllers/admin/producer_properties_controller.rb b/app/controllers/admin/producer_properties_controller.rb index f83911d6a4..2227d45a8f 100644 --- a/app/controllers/admin/producer_properties_controller.rb +++ b/app/controllers/admin/producer_properties_controller.rb @@ -1,8 +1,8 @@ module Admin class ProducerPropertiesController < ResourceController - before_filter :load_enterprise - before_filter :load_properties - before_filter :setup_property, only: [:index] + before_action :load_enterprise + before_action :load_properties + before_action :setup_property, only: [:index] private diff --git a/app/controllers/admin/product_import_controller.rb b/app/controllers/admin/product_import_controller.rb index f35c00a913..8a5b5834b9 100644 --- a/app/controllers/admin/product_import_controller.rb +++ b/app/controllers/admin/product_import_controller.rb @@ -2,7 +2,7 @@ require 'roo' module Admin class ProductImportController < Spree::Admin::BaseController - before_filter :validate_upload_presence, except: %i[index guide validate_data] + before_action :validate_upload_presence, except: %i[index guide validate_data] def index @product_categories = Spree::Taxon.order('name ASC').pluck(:name).uniq diff --git a/app/controllers/admin/schedules_controller.rb b/app/controllers/admin/schedules_controller.rb index 9532e4db9e..cdf6829e54 100644 --- a/app/controllers/admin/schedules_controller.rb +++ b/app/controllers/admin/schedules_controller.rb @@ -3,10 +3,10 @@ require 'order_management/subscriptions/proxy_order_syncer' module Admin class SchedulesController < ResourceController - before_filter :adapt_params, only: [:update] - before_filter :editable_order_cycle_ids_for_create, only: [:create] - before_filter :editable_order_cycle_ids_for_update, only: [:update] - before_filter :check_dependent_subscriptions, only: [:destroy] + before_action :adapt_params, only: [:update] + before_action :editable_order_cycle_ids_for_create, only: [:create] + before_action :editable_order_cycle_ids_for_update, only: [:update] + before_action :check_dependent_subscriptions, only: [:destroy] update.after :sync_subscriptions_for_update respond_to :json diff --git a/app/controllers/admin/stripe_connect_settings_controller.rb b/app/controllers/admin/stripe_connect_settings_controller.rb index bbe75b7806..6f54722fc0 100644 --- a/app/controllers/admin/stripe_connect_settings_controller.rb +++ b/app/controllers/admin/stripe_connect_settings_controller.rb @@ -4,7 +4,7 @@ module Admin class StripeConnectSettingsController < Spree::Admin::BaseController StripeConnectSettings = Struct.new(:stripe_connect_enabled) - before_filter :load_settings, only: [:edit] + before_action :load_settings, only: [:edit] def edit return @stripe_account = { status: :empty_api_key_error_html } if Stripe.api_key.blank? diff --git a/app/controllers/admin/subscription_line_items_controller.rb b/app/controllers/admin/subscription_line_items_controller.rb index c52cca1c3b..573cfec5f2 100644 --- a/app/controllers/admin/subscription_line_items_controller.rb +++ b/app/controllers/admin/subscription_line_items_controller.rb @@ -4,9 +4,9 @@ require 'open_food_network/scope_variant_to_hub' module Admin class SubscriptionLineItemsController < ResourceController - before_filter :load_build_context, only: [:build] - before_filter :ensure_shop, only: [:build] - before_filter :ensure_variant, only: [:build] + before_action :load_build_context, only: [:build] + before_action :ensure_shop, only: [:build] + before_action :ensure_variant, only: [:build] respond_to :json diff --git a/app/controllers/admin/subscriptions_controller.rb b/app/controllers/admin/subscriptions_controller.rb index 11163b6830..f7dd07e236 100644 --- a/app/controllers/admin/subscriptions_controller.rb +++ b/app/controllers/admin/subscriptions_controller.rb @@ -2,12 +2,12 @@ require 'open_food_network/permissions' module Admin class SubscriptionsController < ResourceController - before_filter :load_shops, only: [:index] - before_filter :load_form_data, only: [:new, :edit] - before_filter :strip_banned_attrs, only: [:update] - before_filter :wrap_nested_attrs, only: [:create, :update] - before_filter :check_for_open_orders, only: [:cancel, :pause] - before_filter :check_for_canceled_orders, only: [:unpause] + before_action :load_shops, only: [:index] + before_action :load_form_data, only: [:new, :edit] + before_action :strip_banned_attrs, only: [:update] + before_action :wrap_nested_attrs, only: [:create, :update] + before_action :check_for_open_orders, only: [:cancel, :pause] + before_action :check_for_canceled_orders, only: [:unpause] respond_to :json def index diff --git a/app/controllers/admin/variant_overrides_controller.rb b/app/controllers/admin/variant_overrides_controller.rb index 31aff8ce8c..16c3a48ca7 100644 --- a/app/controllers/admin/variant_overrides_controller.rb +++ b/app/controllers/admin/variant_overrides_controller.rb @@ -5,9 +5,9 @@ module Admin include OpenFoodNetwork::SpreeApiKeyLoader include EnterprisesHelper - prepend_before_filter :load_data - before_filter :load_collection, only: [:bulk_update] - before_filter :load_spree_api_key, only: :index + prepend_before_action :load_data + before_action :load_collection, only: [:bulk_update] + before_action :load_spree_api_key, only: :index def index; end diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index f591154d4c..344dd89174 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -11,9 +11,9 @@ module Api attr_accessor :current_api_user - before_filter :set_content_type - before_filter :authenticate_user - after_filter :set_jsonp_format + before_action :set_content_type + before_action :authenticate_user + after_action :set_jsonp_format rescue_from Exception, with: :error_during_processing rescue_from CanCan::AccessDenied, with: :unauthorized diff --git a/app/controllers/api/enterprise_attachment_controller.rb b/app/controllers/api/enterprise_attachment_controller.rb index 3f5f61e5dd..a1f16ba41d 100644 --- a/app/controllers/api/enterprise_attachment_controller.rb +++ b/app/controllers/api/enterprise_attachment_controller.rb @@ -7,7 +7,7 @@ module Api class MissingImplementationError < StandardError; end class UnknownEnterpriseAuthorizationActionError < StandardError; end - before_filter :load_enterprise + before_action :load_enterprise respond_to :json diff --git a/app/controllers/api/enterprises_controller.rb b/app/controllers/api/enterprises_controller.rb index b4456c5ae4..c7c96e843d 100644 --- a/app/controllers/api/enterprises_controller.rb +++ b/app/controllers/api/enterprises_controller.rb @@ -1,9 +1,9 @@ module Api class EnterprisesController < Api::BaseController - before_filter :override_owner, only: [:create, :update] - before_filter :check_type, only: :update - before_filter :override_sells, only: [:create, :update] - before_filter :override_visible, only: [:create, :update] + before_action :override_owner, only: [:create, :update] + before_action :check_type, only: :update + before_action :override_sells, only: [:create, :update] + before_action :override_visible, only: [:create, :update] respond_to :json def create diff --git a/app/controllers/api/shipments_controller.rb b/app/controllers/api/shipments_controller.rb index d7623da0c7..a3d973945f 100644 --- a/app/controllers/api/shipments_controller.rb +++ b/app/controllers/api/shipments_controller.rb @@ -4,8 +4,8 @@ module Api class ShipmentsController < Api::BaseController respond_to :json - before_filter :find_order - before_filter :find_and_update_shipment, only: [:ship, :ready, :add, :remove] + before_action :find_order + before_action :find_and_update_shipment, only: [:ship, :ready, :add, :remove] def create variant = scoped_variant(params[:variant_id]) diff --git a/app/controllers/api/variants_controller.rb b/app/controllers/api/variants_controller.rb index f0e31e0035..2074c61b0d 100644 --- a/app/controllers/api/variants_controller.rb +++ b/app/controllers/api/variants_controller.rb @@ -3,7 +3,7 @@ module Api respond_to :json skip_authorization_check only: [:index, :show] - before_filter :product + before_action :product def index @variants = scope.includes(option_values: :option_type).ransack(params[:q]).result diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5e2777feac..d521466fae 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,8 +4,8 @@ require_dependency 'spree/authentication_helpers' class ApplicationController < ActionController::Base protect_from_forgery - prepend_before_filter :restrict_iframes - before_filter :set_cache_headers # prevent cart emptying via cache when using back button #1213 + prepend_before_action :restrict_iframes + before_action :set_cache_headers # prevent cart emptying via cache when using back button #1213 include EnterprisesHelper include Spree::AuthenticationHelpers diff --git a/app/controllers/base_controller.rb b/app/controllers/base_controller.rb index fdbe51634d..6cf878a077 100644 --- a/app/controllers/base_controller.rb +++ b/app/controllers/base_controller.rb @@ -14,8 +14,8 @@ class BaseController < ApplicationController helper 'spree/base' - before_filter :set_locale - before_filter :check_order_cycle_expiry + before_action :set_locale + before_action :check_order_cycle_expiry private diff --git a/app/controllers/cart_controller.rb b/app/controllers/cart_controller.rb index b2cf8c04b7..997573899c 100644 --- a/app/controllers/cart_controller.rb +++ b/app/controllers/cart_controller.rb @@ -1,7 +1,7 @@ require 'spree/core/controller_helpers/order_decorator' class CartController < BaseController - before_filter :check_authorization + before_action :check_authorization def populate order = current_order(true) diff --git a/app/controllers/checkout_controller.rb b/app/controllers/checkout_controller.rb index 8e86719f19..6ef86318ca 100644 --- a/app/controllers/checkout_controller.rb +++ b/app/controllers/checkout_controller.rb @@ -13,22 +13,22 @@ class CheckoutController < Spree::StoreController # We need pessimistic locking to avoid race conditions. # Otherwise we fail on duplicate indexes or end up with negative stock. - prepend_around_filter CurrentOrderLocker, only: :update + prepend_around_action CurrentOrderLocker, only: :update - prepend_before_filter :check_hub_ready_for_checkout - prepend_before_filter :check_order_cycle_expiry - prepend_before_filter :require_order_cycle - prepend_before_filter :require_distributor_chosen + prepend_before_action :check_hub_ready_for_checkout + prepend_before_action :check_order_cycle_expiry + prepend_before_action :require_order_cycle + prepend_before_action :require_distributor_chosen - before_filter :load_order + before_action :load_order - before_filter :ensure_order_not_completed - before_filter :ensure_checkout_allowed - before_filter :ensure_sufficient_stock_lines + before_action :ensure_order_not_completed + before_action :ensure_checkout_allowed + before_action :ensure_sufficient_stock_lines - before_filter :associate_user - before_filter :check_authorization - before_filter :enable_embedded_shopfront + before_action :associate_user + before_action :check_authorization + before_action :enable_embedded_shopfront helper 'spree/orders' diff --git a/app/controllers/discourse_sso_controller.rb b/app/controllers/discourse_sso_controller.rb index 17bf6a02e2..bd4abd052c 100644 --- a/app/controllers/discourse_sso_controller.rb +++ b/app/controllers/discourse_sso_controller.rb @@ -4,7 +4,7 @@ class DiscourseSsoController < ApplicationController include SharedHelper include DiscourseHelper - before_filter :require_config + before_action :require_config def login if require_activation? diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 98fe17f0a7..6d640b5d7b 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -7,10 +7,10 @@ class EnterprisesController < BaseController include SerializerHelper # These prepended filters are in the reverse order of execution - prepend_before_filter :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop + prepend_before_action :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop - before_filter :clean_permalink, only: :check_permalink - before_filter :enable_embedded_shopfront + before_action :clean_permalink, only: :check_permalink + before_action :enable_embedded_shopfront respond_to :js, only: :permalink_checker diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index afde45d3bd..c585b63839 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,7 +1,7 @@ class HomeController < BaseController layout 'darkswarm' - before_filter :enable_embedded_shopfront + before_action :enable_embedded_shopfront def index if ContentConfig.home_show_stats diff --git a/app/controllers/line_items_controller.rb b/app/controllers/line_items_controller.rb index 219b836ab4..28b8d4a324 100644 --- a/app/controllers/line_items_controller.rb +++ b/app/controllers/line_items_controller.rb @@ -1,7 +1,7 @@ class LineItemsController < BaseController respond_to :json - before_filter :load_line_item, only: :destroy + before_action :load_line_item, only: :destroy def bought respond_with bought_items, each_serializer: Api::LineItemSerializer diff --git a/app/controllers/producers_controller.rb b/app/controllers/producers_controller.rb index a5f4752c49..108143e5e3 100644 --- a/app/controllers/producers_controller.rb +++ b/app/controllers/producers_controller.rb @@ -1,7 +1,7 @@ class ProducersController < BaseController layout 'darkswarm' - before_filter :enable_embedded_shopfront + before_action :enable_embedded_shopfront def index @enterprises = Enterprise diff --git a/app/controllers/registration_controller.rb b/app/controllers/registration_controller.rb index 5a21d28a44..71e621f077 100644 --- a/app/controllers/registration_controller.rb +++ b/app/controllers/registration_controller.rb @@ -2,8 +2,8 @@ require 'open_food_network/spree_api_key_loader' class RegistrationController < BaseController include OpenFoodNetwork::SpreeApiKeyLoader - before_filter :load_spree_api_key, only: [:index] - before_filter :check_user, except: :authenticate + before_action :load_spree_api_key, only: [:index] + before_action :check_user, except: :authenticate layout 'registration' def index diff --git a/app/controllers/shop_controller.rb b/app/controllers/shop_controller.rb index 7aa5e4e796..c5f90a2856 100644 --- a/app/controllers/shop_controller.rb +++ b/app/controllers/shop_controller.rb @@ -1,7 +1,7 @@ class ShopController < BaseController layout "darkswarm" - before_filter :require_distributor_chosen, :set_order_cycles, except: :changeable_orders_alert - before_filter :enable_embedded_shopfront + before_action :require_distributor_chosen, :set_order_cycles, except: :changeable_orders_alert + before_action :enable_embedded_shopfront def show redirect_to main_app.enterprise_shop_path(current_distributor) diff --git a/app/controllers/shops_controller.rb b/app/controllers/shops_controller.rb index b57c6f5063..d644a5010f 100644 --- a/app/controllers/shops_controller.rb +++ b/app/controllers/shops_controller.rb @@ -1,7 +1,7 @@ class ShopsController < BaseController layout 'darkswarm' - before_filter :enable_embedded_shopfront + before_action :enable_embedded_shopfront def index @enterprises = ShopsListService.new.open_shops diff --git a/app/controllers/spree/admin/adjustments_controller.rb b/app/controllers/spree/admin/adjustments_controller.rb index dc9596d242..b0301aff0f 100644 --- a/app/controllers/spree/admin/adjustments_controller.rb +++ b/app/controllers/spree/admin/adjustments_controller.rb @@ -4,9 +4,9 @@ module Spree belongs_to 'spree/order', find_by: :number destroy.after :reload_order - prepend_before_filter :set_included_tax, only: [:create, :update] - before_filter :set_default_tax_rate, only: :edit - before_filter :enable_updates, only: :update + prepend_before_action :set_included_tax, only: [:create, :update] + before_action :set_default_tax_rate, only: :edit + before_action :enable_updates, only: :update private diff --git a/app/controllers/spree/admin/base_controller.rb b/app/controllers/spree/admin/base_controller.rb index ed0c5cffbb..7ce02d4a38 100644 --- a/app/controllers/spree/admin/base_controller.rb +++ b/app/controllers/spree/admin/base_controller.rb @@ -8,9 +8,9 @@ module Spree include I18nHelper - before_filter :authorize_admin - before_filter :set_locale - before_filter :warn_invalid_order_cycles, if: :html_request? + before_action :authorize_admin + before_action :set_locale + before_action :warn_invalid_order_cycles, if: :html_request? # Warn the user when they have an active order cycle with hubs that are not ready # for checkout (ie. does not have valid shipping and payment methods). diff --git a/app/controllers/spree/admin/images_controller.rb b/app/controllers/spree/admin/images_controller.rb index 168f01466d..8f47fe3576 100644 --- a/app/controllers/spree/admin/images_controller.rb +++ b/app/controllers/spree/admin/images_controller.rb @@ -6,7 +6,7 @@ module Spree # See here https://github.com/spree/spree/commit/334a011d2b8e16355e4ae77ae07cd93f7cbc8fd1 belongs_to 'spree/product', find_by: :permalink - before_filter :load_data + before_action :load_data create.before :set_viewable update.before :set_viewable diff --git a/app/controllers/spree/admin/mail_methods_controller.rb b/app/controllers/spree/admin/mail_methods_controller.rb index a21e3afe7d..aba6ad239f 100644 --- a/app/controllers/spree/admin/mail_methods_controller.rb +++ b/app/controllers/spree/admin/mail_methods_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class MailMethodsController < Spree::Admin::BaseController - after_filter :initialize_mail_settings + after_action :initialize_mail_settings def update params.each do |name, value| diff --git a/app/controllers/spree/admin/orders/customer_details_controller.rb b/app/controllers/spree/admin/orders/customer_details_controller.rb index 7503e42833..d9d8a7355a 100644 --- a/app/controllers/spree/admin/orders/customer_details_controller.rb +++ b/app/controllers/spree/admin/orders/customer_details_controller.rb @@ -2,9 +2,9 @@ module Spree module Admin module Orders class CustomerDetailsController < Spree::Admin::BaseController - before_filter :load_order - before_filter :check_authorization - before_filter :set_guest_checkout_status, only: :update + before_action :load_order + before_action :check_authorization + before_action :set_guest_checkout_status, only: :update def show edit diff --git a/app/controllers/spree/admin/orders_controller.rb b/app/controllers/spree/admin/orders_controller.rb index 960db7f638..a92f255242 100644 --- a/app/controllers/spree/admin/orders_controller.rb +++ b/app/controllers/spree/admin/orders_controller.rb @@ -7,21 +7,21 @@ module Spree include OpenFoodNetwork::SpreeApiKeyLoader helper CheckoutHelper - before_filter :load_order, only: [:edit, :update, :fire, :resend, + before_action :load_order, only: [:edit, :update, :fire, :resend, :invoice, :print, :print_ticket] - before_filter :load_distribution_choices, only: [:new, :edit, :update] + before_action :load_distribution_choices, only: [:new, :edit, :update] # Ensure that the distributor is set for an order when - before_filter :ensure_distribution, only: :new + before_action :ensure_distribution, only: :new # After updating an order, the fees should be updated as well # Currently, adding or deleting line items does not trigger updating the # fees! This is a quick fix for that. # TODO: update fees when adding/removing line items # instead of the update_distribution_charge method. - after_filter :update_distribution_charge, only: :update + after_action :update_distribution_charge, only: :update - before_filter :require_distributor_abn, only: :invoice + before_action :require_distributor_abn, only: :invoice respond_to :html, :json diff --git a/app/controllers/spree/admin/payment_methods_controller.rb b/app/controllers/spree/admin/payment_methods_controller.rb index a142eb6eb1..bb8265c1ff 100644 --- a/app/controllers/spree/admin/payment_methods_controller.rb +++ b/app/controllers/spree/admin/payment_methods_controller.rb @@ -1,10 +1,10 @@ module Spree module Admin class PaymentMethodsController < ResourceController - skip_before_filter :load_resource, only: [:create, :show_provider_preferences] - before_filter :load_data - before_filter :validate_payment_method_provider, only: [:create] - before_filter :load_hubs, only: [:new, :edit, :update] + skip_before_action :load_resource, only: [:create, :show_provider_preferences] + before_action :load_data + before_action :validate_payment_method_provider, only: [:create] + before_action :load_hubs, only: [:new, :edit, :update] create.before :load_hubs respond_to :html diff --git a/app/controllers/spree/admin/payments_controller.rb b/app/controllers/spree/admin/payments_controller.rb index 02c777fb51..215f69972a 100644 --- a/app/controllers/spree/admin/payments_controller.rb +++ b/app/controllers/spree/admin/payments_controller.rb @@ -3,10 +3,10 @@ module Spree module Admin class PaymentsController < Spree::Admin::BaseController - before_filter :load_order, except: [:show] - before_filter :load_payment, only: [:fire, :show] - before_filter :load_data - before_filter :can_transition_to_payment + before_action :load_order, except: [:show] + before_action :load_payment, only: [:fire, :show] + before_action :load_data + before_action :can_transition_to_payment respond_to :html diff --git a/app/controllers/spree/admin/product_properties_controller.rb b/app/controllers/spree/admin/product_properties_controller.rb index d5a783192d..b236b7be7e 100644 --- a/app/controllers/spree/admin/product_properties_controller.rb +++ b/app/controllers/spree/admin/product_properties_controller.rb @@ -2,8 +2,8 @@ module Spree module Admin class ProductPropertiesController < ResourceController belongs_to 'spree/product', find_by: :permalink - before_filter :find_properties - before_filter :setup_property, only: [:index] + before_action :find_properties + before_action :setup_property, only: [:index] private diff --git a/app/controllers/spree/admin/products_controller.rb b/app/controllers/spree/admin/products_controller.rb index d3011d94a0..707a65b3f1 100644 --- a/app/controllers/spree/admin/products_controller.rb +++ b/app/controllers/spree/admin/products_controller.rb @@ -13,10 +13,10 @@ module Spree create.before :create_before update.before :update_before - before_filter :load_data - before_filter :load_form_data, only: [:index, :new, :create, :edit, :update] - before_filter :load_spree_api_key, only: [:index, :variant_overrides] - before_filter :strip_new_properties, only: [:create, :update] + before_action :load_data + before_action :load_form_data, only: [:index, :new, :create, :edit, :update] + before_action :load_spree_api_key, only: [:index, :variant_overrides] + before_action :strip_new_properties, only: [:create, :update] respond_override create: { html: { success: lambda { diff --git a/app/controllers/spree/admin/reports_controller.rb b/app/controllers/spree/admin/reports_controller.rb index 4349e554b3..edcf4baf60 100644 --- a/app/controllers/spree/admin/reports_controller.rb +++ b/app/controllers/spree/admin/reports_controller.rb @@ -23,9 +23,9 @@ module Spree helper_method :render_content? - before_filter :cache_search_state + before_action :cache_search_state # Fetches user's distributors, suppliers and order_cycles - before_filter :load_data, + before_action :load_data, only: [:customers, :products_and_inventory, :order_cycle_management, :packing] respond_to :html diff --git a/app/controllers/spree/admin/resource_controller.rb b/app/controllers/spree/admin/resource_controller.rb index 8b7c0cde12..b34f3729d4 100644 --- a/app/controllers/spree/admin/resource_controller.rb +++ b/app/controllers/spree/admin/resource_controller.rb @@ -4,7 +4,7 @@ module Spree module Admin class ResourceController < Spree::Admin::BaseController helper_method :new_object_url, :edit_object_url, :object_url, :collection_url - before_filter :load_resource, except: [:update_positions] + before_action :load_resource, except: [:update_positions] rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found rescue_from CanCan::AccessDenied, with: :unauthorized diff --git a/app/controllers/spree/admin/search_controller.rb b/app/controllers/spree/admin/search_controller.rb index 1d0f05fc1f..0be57cb0b3 100644 --- a/app/controllers/spree/admin/search_controller.rb +++ b/app/controllers/spree/admin/search_controller.rb @@ -2,7 +2,7 @@ module Spree module Admin class SearchController < Spree::Admin::BaseController # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/ - before_filter :check_json_authenticity, only: :index + before_action :check_json_authenticity, only: :index respond_to :json def known_users diff --git a/app/controllers/spree/admin/shipping_methods_controller.rb b/app/controllers/spree/admin/shipping_methods_controller.rb index fe3bdb5d86..5fa427772e 100644 --- a/app/controllers/spree/admin/shipping_methods_controller.rb +++ b/app/controllers/spree/admin/shipping_methods_controller.rb @@ -1,10 +1,10 @@ module Spree module Admin class ShippingMethodsController < ResourceController - before_filter :load_data, except: [:index] - before_filter :set_shipping_category, only: [:create, :update] - before_filter :set_zones, only: [:create, :update] - before_filter :load_hubs, only: [:new, :edit, :create, :update] + before_action :load_data, except: [:index] + before_action :set_shipping_category, only: [:create, :update] + before_action :set_zones, only: [:create, :update] + before_action :load_hubs, only: [:new, :edit, :create, :update] # Sort shipping methods by distributor name def collection diff --git a/app/controllers/spree/admin/states_controller.rb b/app/controllers/spree/admin/states_controller.rb index 91b7672df2..09d7244439 100644 --- a/app/controllers/spree/admin/states_controller.rb +++ b/app/controllers/spree/admin/states_controller.rb @@ -2,7 +2,7 @@ module Spree module Admin class StatesController < ResourceController belongs_to 'spree/country' - before_filter :load_data + before_action :load_data def index respond_with(@collection) do |format| diff --git a/app/controllers/spree/admin/tax_rates_controller.rb b/app/controllers/spree/admin/tax_rates_controller.rb index 0f828abfee..b9948710d3 100644 --- a/app/controllers/spree/admin/tax_rates_controller.rb +++ b/app/controllers/spree/admin/tax_rates_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class TaxRatesController < ResourceController - before_filter :load_data + before_action :load_data update.after :update_after create.after :create_after diff --git a/app/controllers/spree/admin/users_controller.rb b/app/controllers/spree/admin/users_controller.rb index d70aaa8d9b..dcdcbeb62e 100644 --- a/app/controllers/spree/admin/users_controller.rb +++ b/app/controllers/spree/admin/users_controller.rb @@ -3,11 +3,11 @@ module Spree class UsersController < ResourceController rescue_from Spree::User::DestroyWithOrdersError, with: :user_destroy_with_orders_error - after_filter :sign_in_if_change_own_password, only: :update + after_action :sign_in_if_change_own_password, only: :update # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/ - before_filter :check_json_authenticity, only: :index - before_filter :load_roles, only: [:edit, :new, :update, :create, + before_action :check_json_authenticity, only: :index + before_action :load_roles, only: [:edit, :new, :update, :create, :generate_api_key, :clear_api_key] def index diff --git a/app/controllers/spree/admin/zones_controller.rb b/app/controllers/spree/admin/zones_controller.rb index d8bef6a215..301c32ec70 100644 --- a/app/controllers/spree/admin/zones_controller.rb +++ b/app/controllers/spree/admin/zones_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class ZonesController < ResourceController - before_filter :load_data, except: [:index] + before_action :load_data, except: [:index] def new @zone.zone_members.build diff --git a/app/controllers/spree/orders_controller.rb b/app/controllers/spree/orders_controller.rb index 9c3889c8df..a1c8409941 100644 --- a/app/controllers/spree/orders_controller.rb +++ b/app/controllers/spree/orders_controller.rb @@ -8,22 +8,22 @@ module Spree ssl_required :show - before_filter :check_authorization + before_action :check_authorization rescue_from ActiveRecord::RecordNotFound, with: :render_404 helper 'spree/products', 'spree/orders' respond_to :html respond_to :json - before_filter :update_distribution, only: :update - before_filter :filter_order_params, only: :update - before_filter :enable_embedded_shopfront + before_action :update_distribution, only: :update + before_action :filter_order_params, only: :update + before_action :enable_embedded_shopfront - prepend_before_filter :require_order_authentication, only: :show - prepend_before_filter :require_order_cycle, only: :edit - prepend_before_filter :require_distributor_chosen, only: :edit - before_filter :check_hub_ready_for_checkout, only: :edit - before_filter :check_at_least_one_line_item, only: :update + prepend_before_action :require_order_authentication, only: :show + prepend_before_action :require_order_cycle, only: :edit + prepend_before_action :require_distributor_chosen, only: :edit + before_action :check_hub_ready_for_checkout, only: :edit + before_action :check_at_least_one_line_item, only: :update def show @order = Spree::Order.find_by!(number: params[:id]) diff --git a/app/controllers/spree/store_controller.rb b/app/controllers/spree/store_controller.rb index 42b2dd337f..cc4dd9d537 100644 --- a/app/controllers/spree/store_controller.rb +++ b/app/controllers/spree/store_controller.rb @@ -5,7 +5,7 @@ module Spree include Spree::Core::ControllerHelpers::Order include I18nHelper - before_filter :set_locale + before_action :set_locale def unauthorized render 'shared/unauthorized', status: :unauthorized diff --git a/app/controllers/spree/user_registrations_controller.rb b/app/controllers/spree/user_registrations_controller.rb index 36f0852cef..a55d327ae2 100644 --- a/app/controllers/spree/user_registrations_controller.rb +++ b/app/controllers/spree/user_registrations_controller.rb @@ -8,8 +8,8 @@ module Spree include Spree::Core::ControllerHelpers::SSL ssl_required - before_filter :check_permissions, only: [:edit, :update] - skip_before_filter :require_no_authentication + before_action :check_permissions, only: [:edit, :update] + skip_before_action :require_no_authentication # GET /resource/sign_up def new diff --git a/app/controllers/spree/user_sessions_controller.rb b/app/controllers/spree/user_sessions_controller.rb index f46fdb99fd..82ca577fc3 100644 --- a/app/controllers/spree/user_sessions_controller.rb +++ b/app/controllers/spree/user_sessions_controller.rb @@ -10,7 +10,7 @@ module Spree ssl_required :new, :create, :destroy, :update ssl_allowed :login_bar - before_filter :set_checkout_redirect, only: :create + before_action :set_checkout_redirect, only: :create def create authenticate_spree_user! diff --git a/app/controllers/spree/users_controller.rb b/app/controllers/spree/users_controller.rb index 03aced66c8..c0bd3739b5 100644 --- a/app/controllers/spree/users_controller.rb +++ b/app/controllers/spree/users_controller.rb @@ -2,15 +2,15 @@ module Spree class UsersController < Spree::StoreController layout 'darkswarm' ssl_required - skip_before_filter :set_current_order, only: :show - prepend_before_filter :load_object, only: [:show, :edit, :update] - prepend_before_filter :authorize_actions, only: :new + skip_before_action :set_current_order, only: :show + prepend_before_action :load_object, only: [:show, :edit, :update] + prepend_before_action :authorize_actions, only: :new include Spree::Core::ControllerHelpers include I18nHelper - before_filter :set_locale - before_filter :enable_embedded_shopfront + before_action :set_locale + before_action :enable_embedded_shopfront # Ignores invoice orders, only order where state: 'complete' def show diff --git a/app/controllers/stripe/webhooks_controller.rb b/app/controllers/stripe/webhooks_controller.rb index f079dbc7f2..ce607fd8e7 100644 --- a/app/controllers/stripe/webhooks_controller.rb +++ b/app/controllers/stripe/webhooks_controller.rb @@ -3,7 +3,7 @@ require 'stripe/webhook_handler' module Stripe class WebhooksController < BaseController protect_from_forgery except: :create - before_filter :verify_webhook + before_action :verify_webhook # POST /stripe/webhooks def create diff --git a/app/controllers/user_passwords_controller.rb b/app/controllers/user_passwords_controller.rb index 2db2dc81a4..e467e915e2 100644 --- a/app/controllers/user_passwords_controller.rb +++ b/app/controllers/user_passwords_controller.rb @@ -1,7 +1,7 @@ class UserPasswordsController < Spree::UserPasswordsController layout 'darkswarm' - before_filter :set_admin_redirect, only: :edit + before_action :set_admin_redirect, only: :edit def create render_unconfirmed_response && return if user_unconfirmed? diff --git a/app/controllers/user_registrations_controller.rb b/app/controllers/user_registrations_controller.rb index 2e9870b37e..873d7d4036 100644 --- a/app/controllers/user_registrations_controller.rb +++ b/app/controllers/user_registrations_controller.rb @@ -3,10 +3,10 @@ require 'open_food_network/error_logger' class UserRegistrationsController < Spree::UserRegistrationsController I18N_SCOPE = 'devise.user_registrations.spree_user'.freeze - before_filter :set_checkout_redirect, only: :create + before_action :set_checkout_redirect, only: :create include I18nHelper - before_filter :set_locale + before_action :set_locale # POST /resource/sign_up def create