Module: ActiveRecord::Refined::QueryMethods
- Defined in:
- lib/active_record/refined.rb
Instance Method Summary collapse
- #group(*args, &block) ⇒ Object
- #having(opts = nil, *rest, &block) ⇒ Object
- #joins(*args, &block) ⇒ Object
- #left_outer_joins(*args, &block) ⇒ Object
- #order(*args, &block) ⇒ Object
- #select(*fields, &block) ⇒ Object
- #where(opts = nil, *rest, &block) ⇒ Object
Instance Method Details
#group(*args, &block) ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'lib/active_record/refined.rb', line 82 def group(*args, &block) if block result = evaluate_block(&block) arel = Array(result).map {|node| to_arel_field(node) } super(*arel, &nil) else super end end |
#having(opts = nil, *rest, &block) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/active_record/refined.rb', line 64 def having(opts = nil, *rest, &block) if block super(evaluate_block(&block).to_arel(table)) else super end end |
#joins(*args, &block) ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/active_record/refined.rb', line 92 def joins(*args, &block) if block super(build_join_node(args.first, Arel::Nodes::InnerJoin, &block)) else super end end |
#left_outer_joins(*args, &block) ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/active_record/refined.rb', line 100 def left_outer_joins(*args, &block) if block joins(build_join_node(args.first, Arel::Nodes::OuterJoin, &block)) else super end end |
#order(*args, &block) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/active_record/refined.rb', line 72 def order(*args, &block) if block result = evaluate_block(&block) arel = Array(result).map {|node| to_arel_field(node) } super(*arel, &nil) else super end end |
#select(*fields, &block) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/active_record/refined.rb', line 54 def select(*fields, &block) if block result = evaluate_block(&block) arel = Array(result).map {|node| to_arel_field(node) } super(*arel, &nil) else super end end |
#where(opts = nil, *rest, &block) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/active_record/refined.rb', line 46 def where(opts = nil, *rest, &block) if block super(evaluate_block(&block).to_arel(table)) else super end end |