#97 ✓resolved
François Beausoleil

#downcase maps previous call to a relationship

Reported by François Beausoleil | August 30th, 2007 @ 08:06 AM

Party.select {|p| p.display_name.downcase =~ "beausoleil%"}.to_sql

Dies with a nice backtrace:

RuntimeError: No reflection `display_name' found on Party
        from /home/src/vendor/plugins/ambition/lib/ambition/processor.rb:63:in `extract_includes'
        from /home/src/vendor/plugins/ambition/lib/ambition/where.rb:138:in `translation'
        from /home/src/vendor/plugins/ambition/lib/ambition/where.rb:42:in `process_call'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `send'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `process'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:299:in `error_handler'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:240:in `process'
        from /home/src/vendor/plugins/ambition/lib/ambition/where.rb:134:in `translation'
        from /home/src/vendor/plugins/ambition/lib/ambition/where.rb:42:in `process_call'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `send'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `process'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:299:in `error_handler'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:240:in `process'
        from /home/src/vendor/plugins/ambition/lib/ambition/processor.rb:28:in `process_proc'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `send'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `process'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:299:in `error_handler'
        from ./script/../config/../config/../vendor/ParseTree-2.0.1/lib/sexp_processor.rb:240:in `process'
        from /home/src/vendor/plugins/ambition/lib/ambition/processor.rb:45:in `to_s'
        from /home/src/vendor/plugins/ambition/lib/ambition/query.rb:70:in `keyed_clauses'
        from (irb):7:in `inject'
        from /home/src/vendor/plugins/ambition/lib/ambition/query.rb:68:in `each'
        from /home/src/vendor/plugins/ambition/lib/ambition/query.rb:68:in `inject'
        from /home/src/vendor/plugins/ambition/lib/ambition/query.rb:68:in `keyed_clauses'
        from /home/src/vendor/plugins/ambition/lib/ambition/query.rb:55:in `to_sql'
        from (irb):7

I don't know if this is too much magic. I actually wanted SQL matching:

SELECT * FROM parties WHERE LOWER(display_name) LIKE 'beausoleil%'

Thanks for this plugin !

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Tags

Pages