#14 ✓invalid
Marko Seppä

Wrong finder behaviour

Reported by Marko Seppä | August 13th, 2009 @ 03:04 PM

These similar queries result to different SQL find statement - altough they should be the same thing.
The latter one does not use translations at all.

Tracker.find_by_title('tracker')

=> SELECT "sections".* FROM "sections" INNER JOIN "section_translations" ON section_translations.section_id = sections.id WHERE (section_translations.title = 'tracker' AND section_translations.locale IN ('en','root')) AND ( ("sections"."type" = 'Tracker' ) ) ORDER BY lft LIMIT 1

Tracker.find(:first, :conditions => {:title => 'tracker'})

=> SELECT * FROM "sections" WHERE ("sections"."title" = 'tracker') AND ( ("sections"."type" = 'Tracker' ) ) ORDER BY lft LIMIT 1

Comments and changes to this ticket

  • Josh H

    Josh H August 17th, 2009 @ 01:01 PM

    • Assigned user set to “Josh H”
    • State changed from “new” to “invalid”

    This isn't exactly a bug. The find_by_* feature was added as a special advanced feature to support limited translation finding. Expanding this to the general case would be very complicated and is probably not worth doing at this point.

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 »

The second incarnation of Globalize for Rails, which will let your Rails app speak any language on Earth, and beyond.

People watching this ticket

Pages