#1107 ✓not-applicable
ojak

Properties cannot be used as condition values in comparison queries.

Reported by ojak | October 23rd, 2009 @ 11:00 PM

Issue

The following DM query does not trigger a query:

Post.all(:created_at.lt => :updated_at)

Expected behavior

The created_at and updated_at columns would be compared, such as in the following SQL query:

SELECT * FROM "posts" WHERE "created_at" < "updated_at";

Attached is a sample file that shows the behavior.

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) October 24th, 2009 @ 02:48 AM

    • State changed from “new” to “not-applicable”

    This is by design.

    There are a few types in dm-types where a Symbol is the expected value. In those cases it would be difficult to determine if you meant to search normally, or if you meant to match another property like the example shown above.

    Also this idea is very RDBMS centric. It may not be possible to implement anywhere else other than databases. In the case where this is needed we provide the :conditions raw query, and for more advanced cases find_by_sql from the dm-ar-finders plugin.

    While I wish that wasn't the case, and this feature could be added, I do not think it will be made part of the dm-core API, since every adapter is expected to be able to implement the core requirements.

    BTW This might not be too difficult to implement as a plugin if you need it regularly.

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 »

People watching this ticket

Attachments

Pages