hzamani / acts_as_relation

Multi table Inheritance for rails
http://hzamani.github.com/acts_as_relation/
MIT License
180 stars 58 forks source link

Cannot use created_at or any timestamp columns to query: ambiguous column name #57

Closed niiamon closed 10 years ago

niiamon commented 10 years ago

Fell into another issue here with acts_as_relation. From the dummy project in the acts_as_relation code, I run the migrations and then created a few objects. However, it's not possible to execute a query like this:

Pencil.where("created_at <= ?", Date.new())

You get an "ambiguous column name" error. Other than removing the created_at and updated_at columns on the subclasses or parent class, is there another way to get around this?

barriault commented 10 years ago

This works:

Pencil.where("pencils.created_at <= ?", Time.now)
niiamon commented 10 years ago

RIght. I'm going to give that a go. Thanks.