mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
@@ -25,15 +25,14 @@ module Admin
|
||||
|
||||
protected
|
||||
|
||||
def build_resource_with_address
|
||||
enterprise_group = build_resource_without_address
|
||||
def build_resource
|
||||
enterprise_group = super
|
||||
enterprise_group.address = Spree::Address.new
|
||||
enterprise_group.address.country = Spree::Country.find_by(
|
||||
id: Spree::Config[:default_country_id]
|
||||
)
|
||||
enterprise_group
|
||||
end
|
||||
alias_method_chain :build_resource, :address
|
||||
|
||||
# Overriding method on Spree's resource controller,
|
||||
# so that resources are found using permalink.
|
||||
|
||||
@@ -114,13 +114,12 @@ module Admin
|
||||
|
||||
protected
|
||||
|
||||
def build_resource_with_address
|
||||
enterprise = build_resource_without_address
|
||||
def build_resource
|
||||
enterprise = super
|
||||
enterprise.address ||= Spree::Address.new
|
||||
enterprise.address.country ||= Spree::Country.find_by(id: Spree::Config[:default_country_id])
|
||||
enterprise
|
||||
end
|
||||
alias_method_chain :build_resource, :address
|
||||
|
||||
# Overriding method on Spree's resource controller,
|
||||
# so that resources are found using permalink
|
||||
|
||||
@@ -2,15 +2,15 @@ class Customer < ActiveRecord::Base
|
||||
acts_as_taggable
|
||||
|
||||
belongs_to :enterprise
|
||||
belongs_to :user, class_name: Spree.user_class
|
||||
has_many :orders, class_name: Spree::Order
|
||||
belongs_to :user, class_name: Spree.user_class.to_s
|
||||
has_many :orders, class_name: "Spree::Order"
|
||||
before_destroy :check_for_orders
|
||||
|
||||
belongs_to :bill_address, foreign_key: :bill_address_id, class_name: Spree::Address
|
||||
belongs_to :bill_address, foreign_key: :bill_address_id, class_name: "Spree::Address"
|
||||
alias_attribute :billing_address, :bill_address
|
||||
accepts_nested_attributes_for :bill_address
|
||||
|
||||
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: Spree::Address
|
||||
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: "Spree::Address"
|
||||
alias_attribute :shipping_address, :ship_address
|
||||
accepts_nested_attributes_for :ship_address
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class DistributorShippingMethod < ActiveRecord::Base
|
||||
self.table_name = "distributors_shipping_methods"
|
||||
belongs_to :shipping_method, class_name: Spree::ShippingMethod, touch: true
|
||||
belongs_to :distributor, class_name: Enterprise, touch: true
|
||||
belongs_to :shipping_method, class_name: "Spree::ShippingMethod", touch: true
|
||||
belongs_to :distributor, class_name: "Enterprise", touch: true
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class EnterpriseRole < ActiveRecord::Base
|
||||
belongs_to :user, class_name: Spree.user_class
|
||||
belongs_to :user, class_name: Spree.user_class.to_s
|
||||
belongs_to :enterprise
|
||||
|
||||
validates :user_id, :enterprise_id, presence: true
|
||||
|
||||
@@ -8,8 +8,8 @@ class Subscription < ActiveRecord::Base
|
||||
belongs_to :schedule
|
||||
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod'
|
||||
belongs_to :payment_method, class_name: 'Spree::PaymentMethod'
|
||||
belongs_to :bill_address, foreign_key: :bill_address_id, class_name: Spree::Address
|
||||
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: Spree::Address
|
||||
belongs_to :bill_address, foreign_key: :bill_address_id, class_name: "Spree::Address"
|
||||
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: "Spree::Address"
|
||||
has_many :subscription_line_items, inverse_of: :subscription
|
||||
has_many :order_cycles, through: :schedule
|
||||
has_many :proxy_orders
|
||||
|
||||
@@ -200,7 +200,5 @@ module Openfoodnetwork
|
||||
config.active_support.escape_html_entities_in_json = true
|
||||
|
||||
config.active_job.queue_adapter = :delayed_job
|
||||
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
module OrderManagement
|
||||
module Reports
|
||||
class BulkCoopController < Spree::Admin::BaseController
|
||||
before_filter :load_report_parameters
|
||||
before_filter :load_permissions
|
||||
before_action :load_report_parameters
|
||||
before_action :load_permissions
|
||||
|
||||
def new; end
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
module OrderManagement
|
||||
module Reports
|
||||
class EnterpriseFeeSummariesController < Spree::Admin::BaseController
|
||||
before_filter :load_report_parameters
|
||||
before_filter :load_permissions
|
||||
before_action :load_report_parameters
|
||||
before_action :load_permissions
|
||||
|
||||
def new; end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ module Spree
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_filter :ensure_api_key
|
||||
before_action :ensure_api_key
|
||||
|
||||
rescue_from CanCan::AccessDenied do
|
||||
unauthorized
|
||||
|
||||
@@ -12,7 +12,7 @@ module Spree
|
||||
|
||||
layout :get_layout
|
||||
|
||||
before_filter :set_user_language
|
||||
before_action :set_user_language
|
||||
|
||||
protected
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module Spree
|
||||
base.class_eval do
|
||||
helper_method :current_order
|
||||
helper_method :current_currency
|
||||
before_filter :set_current_order
|
||||
before_action :set_current_order
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ module Spree
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_filter :force_non_ssl_redirect, if: proc { Spree::Config[:redirect_https_to_http] }
|
||||
before_action :force_non_ssl_redirect, if: proc { Spree::Config[:redirect_https_to_http] }
|
||||
|
||||
def self.ssl_allowed(*actions)
|
||||
class_attribute :ssl_allowed_actions
|
||||
|
||||
@@ -5,7 +5,7 @@ require 'spec_helper'
|
||||
describe Spree::Admin::BaseController, type: :controller do
|
||||
controller(Spree::Admin::BaseController) do
|
||||
def index
|
||||
before_filter :unauthorized
|
||||
before_action :unauthorized
|
||||
render text: ""
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user