{"comment":{"created_at":"2011-10-11T21:09:21Z","body":"What about scopes?\r\n\r\nclass User < ActiveRecord::Base\r\n  self.abstract_class = true\r\n  scope :something, where(:name => 'something')\r\nend\r\n\r\nclass Admin < User\r\nend\r\n\r\nAdmin.something.to_sql => \"SELECT \\\"admins\\\".* FROM \\\"admins\\\"  WHERE \\\"\\\".\\\"name\\\" = 'something'\"","updated_at":"2011-10-11T21:09:21Z","url":"https://api.github.com/repos/rails/rails/issues/comments/2371227","id":2371227,"user":{"avatar_url":"https://secure.gravatar.com/avatar/3b40f8a0c0a46dc86879e6f4e658faa8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/route","id":414803,"login":"route"}},"action":"created","issue":{"number":2679,"created_at":"2011-08-24T22:48:45Z","pull_request":{"diff_url":"https://github.com/rails/rails/pull/2679.diff","patch_url":"https://github.com/rails/rails/pull/2679.patch","html_url":"https://github.com/rails/rails/pull/2679"},"body":"I found a trivial inconsistency on AR table_name computing behavior.\r\n\r\nWhile there are an abstract_class model and its child:\r\n\r\n```ruby\r\nclass User < ActiveRecord::Base\r\n  self.abstract_class = true\r\nend\r\n\r\nclass Admin < User\r\nend\r\n```\r\n\r\nThe child's table_name changes depending on whether the abstract model's table_name were called or not.\r\n\r\n```ruby\r\nUser.table_name\r\n=> \"users\"\r\nUser.scoped.to_sql\r\n=> SELECT \"users\".* FROM \"users\"\r\nAdmin.table_name\r\n=> \"users\"\r\nAdmin.scoped.to_sql\r\n=> SELECT \"users\".* FROM \"users\"\r\n\r\nAdmin.table_name\r\n=> \"admins\"\r\nAdmin.scoped.to_sql\r\n=> SELECT \"admins\".* FROM \"admins\"\r\n```\r\n\r\nThis doesn't matter for normal use, but sometimes causes weird errors, for example, when dealing with an AR extension plugin that scans through descendants of AR::Base on Railtie hook.\r\n\r\nHere's a patch that makes abstract models always skip compute_table_name.","comments":4,"title":"do not compute table names for abstract classes","updated_at":"2011-10-11T21:09:21Z","url":"https://api.github.com/repos/rails/rails/issues/2679","id":1478780,"assignee":null,"milestone":null,"closed_at":"2011-08-24T23:05:26Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/76a777ff80f30bd3b390e275cce625bc?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/amatsuda","id":11493,"login":"amatsuda"},"html_url":"https://github.com/rails/rails/issues/2679","labels":[],"state":"closed"},"legacy":{"issue_id":1478780,"comment_id":2371227}}