| 135 | | def method_missing(method, *args) |
|---|
| 136 | | if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) |
|---|
| 137 | | if block_given? |
|---|
| 138 | | super { |*block_args| yield(*block_args) } |
|---|
| 139 | | else |
|---|
| 140 | | super |
|---|
| 141 | | end |
|---|
| 142 | | elsif @reflection.klass.scopes.include?(method) |
|---|
| 143 | | @reflection.klass.scopes[method].call(self, *args) |
|---|
| 144 | | else |
|---|
| 145 | | with_scope construct_scope do |
|---|
| 146 | | if block_given? |
|---|
| 147 | | @reflection.klass.send(method, *args) { |*block_args| yield(*block_args) } |
|---|
| 148 | | else |
|---|
| 149 | | @reflection.klass.send(method, *args) |
|---|
| 150 | | end |
|---|
| 151 | | end |
|---|
| 152 | | end |
|---|
| 153 | | end |
|---|
| 154 | | |
|---|