Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/dolzenko/django_q_object.rb,
lib/dolzenko/django_f_object.rb

Overview

Rails 3

Instance Method Summary collapse

Instance Method Details

#build_where_with_f_object(*args) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/dolzenko/django_f_object.rb', line 100

def build_where_with_f_object(*args)
  if args.size == 1 && args[0].is_a?(Hash)
    hash_conditions = args[0]
    hash_conditions.each { |_, v| v.klass = klass if v.is_a?(F) }
  end

  build_where_without_f_object(*args)
end

#build_where_with_q_object(*args) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/dolzenko/django_q_object.rb', line 103

def build_where_with_q_object(*args)
  if args.size == 1 && args[0].is_a?(Q)
    return args[0].to_q_sql(klass)
  end

  build_where_without_q_object(*args)
end