From 065859b90cc5ef403b8f47bd5394b343e556cc4d Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 23 Mar 2016 21:48:52 +0100 Subject: upgrade: remove references to RestClient CouchRest > 1.2 does not use RestClient anymore. So we should not try to catch its errors. --- engines/support/app/models/ticket.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/support/app/models') diff --git a/engines/support/app/models/ticket.rb b/engines/support/app/models/ticket.rb index b1bdf8d..4615a10 100644 --- a/engines/support/app/models/ticket.rb +++ b/engines/support/app/models/ticket.rb @@ -50,7 +50,7 @@ class Ticket < CouchRest::Model::Base self.by_created_by.key(user.id).each do |ticket| ticket.destroy end - rescue RestClient::ResourceNotFound + rescue RESOURCE_NOT_FOUND # silently ignore if design docs are not yet created end -- cgit v1.2.3 From b851fe2fd6e0029df81976b647ede7190a1fd547 Mon Sep 17 00:00:00 2001 From: Azul Date: Sun, 22 May 2016 21:11:48 +0200 Subject: make ticket tests pass without network connection MX validations relied on network connection. Only using them in production environment now. I want to be able to develop and test when disconnected. --- engines/support/app/models/ticket.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/support/app/models') diff --git a/engines/support/app/models/ticket.rb b/engines/support/app/models/ticket.rb index 4615a10..025e2ab 100644 --- a/engines/support/app/models/ticket.rb +++ b/engines/support/app/models/ticket.rb @@ -37,9 +37,11 @@ class Ticket < CouchRest::Model::Base # email can be nil, "", or valid address. # validation provided by 'valid_email' gem. + # mx validation depends on network availability and is disabled in test + # and development environment validates :email, :allow_blank => true, :email => true, - :mx_with_fallback => true + :mx_with_fallback => Rails.env.production? def self.search(options = {}) @selection = TicketSelection.new(options) -- cgit v1.2.3 From 638acc59a241e141cf0fc9ccbf4e3c5578b98f0c Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 4 Jul 2016 20:19:21 +0200 Subject: Fix db:migrate and similar tasks We saw errors from duplicate loading of LocalEmail and LoginFormatValidation. The latter resulted in a crash. In an attempt to ensure all subclasses of Couchrest::Model::Base are loaded Couchrest::Model::Utils::Migrate requires all files in app/models. We have an extension that does the same for the engines. During this process LoginFormatValidation and LocalEmail were autoloaded when 'identity' was required. Afterwards they were required again. It looks like rails' autoload mechanism does not play nicely with require. So to make sure they are not autoloaded first move the concerns and helper classes into the lib directory and require them explicitly. --- engines/support/app/models/account_extension/tickets.rb | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 engines/support/app/models/account_extension/tickets.rb (limited to 'engines/support/app/models') diff --git a/engines/support/app/models/account_extension/tickets.rb b/engines/support/app/models/account_extension/tickets.rb deleted file mode 100644 index f38d5fd..0000000 --- a/engines/support/app/models/account_extension/tickets.rb +++ /dev/null @@ -1,13 +0,0 @@ -module AccountExtension::Tickets - extend ActiveSupport::Concern - - def destroy_with_tickets(destroy_identities=false) - Ticket.destroy_all_from(self.user) - destroy_without_tickets(destroy_identities) - end - - included do - alias_method_chain :destroy, :tickets - end - -end -- cgit v1.2.3