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
86 87 88 89 90 91 92 93 94 |
# File 'lib/active_record/refined.rb', line 86 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
68 69 70 71 72 73 74 |
# File 'lib/active_record/refined.rb', line 68 def having(opts = nil, *rest, &block) if block super(evaluate_block(&block).to_arel(table)) else super end end |
#joins(*args, &block) ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/active_record/refined.rb', line 96 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
104 105 106 107 108 109 110 |
# File 'lib/active_record/refined.rb', line 104 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
76 77 78 79 80 81 82 83 84 |
# File 'lib/active_record/refined.rb', line 76 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
58 59 60 61 62 63 64 65 66 |
# File 'lib/active_record/refined.rb', line 58 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
50 51 52 53 54 55 56 |
# File 'lib/active_record/refined.rb', line 50 def where(opts = nil, *rest, &block) if block super(evaluate_block(&block).to_arel(table)) else super end end |