I don't know how to explain this more, I'm open to suggestions.
Here is an example:
User.last.orders.detect { |user_order| user_order.query.id == 107 }
This doesn't work;
NameError: undefined local variable or method ` user_order' for main:Object
from (pry):51:in `block in <main>'
But this works:
User.last.orders.detect do |user_order|
user_order.query.id == 107
end
This is just a simple example. I really don't understand why this happens. Thanks!