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



97
98
99
100
101
102
103
104
# File 'lib/dolzenko/django_f_object.rb', line 97

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



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

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