{"comment":{"created_at":"2011-10-14T20:48:32Z","body":"Yep, I think you're right -- forcing `tables_in_string` to return an empty array definitely fixes my problem.\r\n\r\nI think fixing this might be tricky -- I'll need to dive deeper than my current knowledge into the inner workings of ActiveRecord.","updated_at":"2011-10-14T20:48:32Z","url":"https://api.github.com/repos/rails/rails/issues/comments/2411241","id":2411241,"user":{"gravatar_id":"8ef35025aa70ab0af32966c81725018a","avatar_url":"https://secure.gravatar.com/avatar/8ef35025aa70ab0af32966c81725018a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/peterjm","id":55985,"login":"peterjm"}},"action":"created","issue":{"number":950,"created_at":"2011-05-16T04:48:23Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"*Imported from Lighthouse.* Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6611\nCreated by **Corey Ward** - 2011-03-24 03:00:22 UTC\n\nI have created a barebones Rails app demonstrating this bug: https://github.com/coreyward/bug-demo\n\nI also have a Question open on StackOverflow about this: http://stackoverflow.com/questions/5199235/activerecord-query-changing-when-a-dot-period-is-in-condition-value\n\nI don't have the skills/knowledge to know A) where this is coming from or B) how to fix it. Any help would be very much appreciated.\n\n---\n\nThis bug occurs when you have a \"child\" model (one that `belongs_to` another model) with an `order` scope on it and you try to set a `where` condition.\n\nSo for the following models:\n\n    class Person < ActiveRecord::Base\n      has_many :items\n    end\n    \n    class Item < ActiveRecord::Base\n      belongs_to :person\n      default_scope order(:ordinal)\n    end\n\nWith the following calls:\n\n    Person.includes(:items).where(:name => 'John')\n    # or\n    Person.includes(:items).find_by_name 'John'\n    \nThe items loaded are ordered by the `ordinal` on each `Item`. \n\nIf you introduce a period into the name, though (e.g. \"John.Smith\"), the order scope is ignored.\n\nTo see this in action...\n\n    $ git clone git://github.com/coreyward/bug-demo.git\n    $ cd bug-demo\n    $ rake db:create db:migrate db:seed\n    $ rails s\n\nAnd then fire up [http://localhost:3000/](http://localhost:3000/) and see for yourself.","comments":11,"title":"ActiveRecord query changing when a dot/period is in condition value","updated_at":"2011-10-14T20:48:32Z","url":"https://api.github.com/repos/rails/rails/issues/950","id":904757,"assignee":null,"milestone":null,"closed_at":null,"user":{"gravatar_id":"0c32990bcc0183c5b4ab0dc869946af7","avatar_url":"https://secure.gravatar.com/avatar/0c32990bcc0183c5b4ab0dc869946af7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/lighthouse-import","id":789801,"login":"lighthouse-import"},"html_url":"https://github.com/rails/rails/issues/950","labels":[],"state":"open"},"legacy":{"issue_id":904757,"comment_id":2411241}}