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