khiav223577/left_joins

View on GitHub
lib/left_joins_for_rails_3.rb

Summary

Maintainability
A
0 mins
Test Coverage
# ----------------------------------------------------------------
# ● Implement check_if_method_has_arguments! method for Rails 3
# ----------------------------------------------------------------
module ActiveRecord::QueryMethods
  def check_if_method_has_arguments!(method_name, args)
    if args.blank?
      raise ArgumentError, "The method .#{method_name}() must contain arguments."
    end
  end
end

module ActiveRecord::Calculations
  def distinct_value
    uniq_value
  end

  def distinct_value=(v)
    self.uniq_value = v
  end
end