diff --git a/BrainPortal/config/initializers/added_core_extensions/active_record.rb b/BrainPortal/config/initializers/added_core_extensions/active_record.rb index be1b1a00e..56a784e12 100644 --- a/BrainPortal/config/initializers/added_core_extensions/active_record.rb +++ b/BrainPortal/config/initializers/added_core_extensions/active_record.rb @@ -34,12 +34,6 @@ class Relation #:nodoc: prepend CBRAINExtensions::ActiveRecordExtensions::RelationExtensions::SafeInspect - ##################################################################### - # ActiveRecord::Relation Added Behavior For Unstructured Data Fetches - ##################################################################### - - include CBRAINExtensions::ActiveRecordExtensions::RelationExtensions::RawData - ##################################################################### # ActiveRecord::Relation Added Behavior For API Requests ##################################################################### diff --git a/BrainPortal/lib/cbrain_extensions/active_record_extensions/relation_extensions/raw_data.rb b/BrainPortal/lib/cbrain_extensions/active_record_extensions/relation_extensions/raw_data.rb deleted file mode 100644 index d990c182d..000000000 --- a/BrainPortal/lib/cbrain_extensions/active_record_extensions/relation_extensions/raw_data.rb +++ /dev/null @@ -1,74 +0,0 @@ - -# -# CBRAIN Project -# -# Copyright (C) 2008-2012 -# The Royal Institution for the Advancement of Learning -# McGill University -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -module CBRAINExtensions #:nodoc: - module ActiveRecordExtensions #:nodoc: - module RelationExtensions - # ActiveRecord::Relation Added Behavior For Unstructured Data Fetches - module RawData - - Revision_info=CbrainFileRevision[__FILE__] #:nodoc: - - # Returns an array with just the first column of the - # current relation. If an argument is given in +selected+, - # then the relation is first modified with .select(selected) - # - # User.where('login like "a%"').select(:login).raw_first_column - # => ["annie", "ahmed", "albator"] - # - # User.where('login like "a%"').select(:id).raw_first_column - # => [3,4,7] - # - # User.where('login like "a%"').raw_first_column(:id) - # => [3,4,7] - # - # This is basically a wrapper around the connection's - # select_values() method (not to be confused with the - # same method defined in ActiveRecord::Relation, which - # does something completely different). - def raw_first_column(selected = nil) - modif = selected.present? ? self.select(selected) : self - self.klass.connection.select_values(modif.to_sql) - end - - # Returns an array of small arrays containing each record selected - # by the current relation. If an argument is given in +selected+, - # then the relation is first modified with .select(selected) - # - # User.where('login like "a%"').select([:id,:login]).raw_rows - # => [[3, "annie"], [4, "ahmed"], [7, "albator"]] - # - # User.where('login like "a%"').raw_rows([:id,:login]) - # => [[3, "annie"], [4, "ahmed"], [7, "albator"]] - # - # This is basically a wrapper around the connection's - # select_rows() method. - def raw_rows(*args) - selected = args.flatten - modif = selected.present? ? self.select(selected) : self - self.klass.connection.select_rows(modif.to_sql) - end - - end - end - end -end