<commit_before># This plugin just for less than 3.x.x version rails

module RelationScope
  def self.included(base)
    base.class_eval do
      named_scope :where,    lambda { |conditions| { :conditions => conditions.reject { |k, v| v.blank? } } }
      named_scope :joins,    lambda { |joins| { :joins => joins } }
      named_scope :includes, lambda { |includes| { :include => includes } }
      named_scope :selects,  lambda { |selects| { :select => selects } }
      named_scope :order,    lambda { |order| { :order => order } }
      named_scope :limit,    lambda { |limit| { :limit => limit } }
      named_scope :offset,   lambda { |offset| { :offset => offset } }
      named_scope :group,    lambda { |group| { :group => group } }
      named_scope :having,   lambda { |having| { :having => having } }
    end
  end
end

ActiveRecord::Base.send(:include, RelationScope)<commit_msg>fix bug for NamedScope method 'where'<commit_after># This plugin just for rails version 2.3.x with named scope module

module RelationScope
  def self.included(base)
    base.class_eval do
      named_scope :where,    lambda { |args|
        conditions = args.is_a?(Hash) ? args.reject { |k, v| v.blank? } : args
        { :conditions => conditions }
      }
      named_scope :joins,    lambda { |joins| { :joins => joins } }
      named_scope :includes, lambda { |includes| { :include => includes } }
      named_scope :select,   lambda { |select| { :select => select } }
      named_scope :order,    lambda { |order| { :order => order } }
      named_scope :limit,    lambda { |limit| { :limit => limit } }
      named_scope :offset,   lambda { |offset| { :offset => offset } }
      named_scope :group,    lambda { |group| { :group => group } }
      named_scope :having,   lambda { |having| { :having => having } }
    end
  end
end

ActiveRecord::Base.send(:include, RelationScope)
{'fraction_non_alphanumeric': 0.13684771033013846, 'fraction_numerical': 0.001597444089456869, 'mean_word_length': 2.939203354297694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '620624', 'n_tokens_mistral': 593, 'n_tokens_neox': 577, 'n_words': 166}