On Wednesday, 13 November 2013 at 08:26:52 UTC, Jacob Carlborg wrote:

I'm using a pluign to Ruby on Rails that does something similar but by overloading operators. The problem with this approach, in Ruby, is that you cannot overload operators like || and &&, so instead they overload | and & resulting in new problems like operator precedence. Example:

Person.where{ |e| (e.name == "John") & (e.address == "Main street") }

Is this in any way better than the basic Ruby

  where( name: 'John', address: 'Main street' )

? Or was it just something quick and contrived to show the behavior, and not the utility, of the plugin? Just curious.

Reply via email to