From 61b260fb8a64577abb8014c4bacbfd8b90a0434c Mon Sep 17 00:00:00 2001 From: zmagod Date: Fri, 27 Jan 2017 11:01:44 +0100 Subject: [PATCH] fixes bug in protocol management --- app/datatables/protocols_datatable.rb | 2 +- db/migrate/20170124135736_rename_organization_to_team.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/datatables/protocols_datatable.rb b/app/datatables/protocols_datatable.rb index ab8f3fef6..7b764190c 100644 --- a/app/datatables/protocols_datatable.rb +++ b/app/datatables/protocols_datatable.rb @@ -127,7 +127,7 @@ class ProtocolsDatatable < AjaxDatatablesRails::Base if @type == :public records = records - .joins('LEFT OUTER JOIN users ON users.id = protocols.added_by_id"') + .joins('LEFT OUTER JOIN users ON users.id = protocols.added_by_id') .where('protocols.protocol_type = ?', Protocol.protocol_types[:in_repository_public]) elsif @type == :private diff --git a/db/migrate/20170124135736_rename_organization_to_team.rb b/db/migrate/20170124135736_rename_organization_to_team.rb index 0b1c0743b..474b1e046 100644 --- a/db/migrate/20170124135736_rename_organization_to_team.rb +++ b/db/migrate/20170124135736_rename_organization_to_team.rb @@ -1,5 +1,9 @@ class RenameOrganizationToTeam < ActiveRecord::Migration def up + unless ActiveRecord::Base.connection.table_exists?('organizations') && + ActiveRecord::Base.connection.table_exists?('user_organizations') + return + end rename_table :organizations, :teams rename_table :user_organizations, :user_teams @@ -17,6 +21,10 @@ class RenameOrganizationToTeam < ActiveRecord::Migration end def down + unless ActiveRecord::Base.connection.table_exists?('teams') && + ActiveRecord::Base.connection.table_exists?('user_teams') + return + end rename_table :teams, :organizations rename_table :user_teams, :user_organizations