This project is archived and is in readonly mode.

#1570 ✓resolved
Paweł Kondzior

named_scope not preserving proper model in STI

Reported by Paweł Kondzior | December 14th, 2008 @ 03:26 AM | in 2.3.9

Simple example:


class User < ActiveRecord::Base
  named_scope(:simple_test, lambda { puts self.inspect; {} })
end

class Employee < ActiveRecord::Base
end

And the result:

Loading development environment (Rails 2.3.0)

Employee.simple_test(123) User(id: integer, created_at: datetime, updated_at: datetime, active: boolean, type: string, location_id: integer, name: string, email: string) => []

In such case we don't have access to Emloyee class methods, reflection and other from lambda.

Comments and changes to this ticket

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages