Can't co-exist with scope like where(:status => :ACTIVE) #171

Closed
zhangxue opened this Issue Sep 28, 2012 · 3 comments

Comments

Projects
None yet
4 participants
@zhangxue

After adding squeel into the project, all existing scope that has expressions like where(:status => :ACTIVE) failed, because it generates sql like:
SELECT people.* FROM people WHERE people.status = people.ACTIVE

Of course changing :ACTIVE into string will solve the problem, but I am a little worried about needing to double check all existing scope. And the conflict with standard rails usage also make me hesitate to use squeel, since someone new may break it easily.

Any ideas/suggestions?

Btw: I am using Rails 3.1.1 and I leave symbol extension disabled.

@vendethiel

This comment has been minimized.

Show comment Hide comment
@vendethiel

vendethiel Sep 28, 2012

#67

@phantomwhale

This comment has been minimized.

Show comment Hide comment
@phantomwhale

phantomwhale Sep 28, 2012

Having looked over older issues, we concluded that you can't use symbols for the RHS of where clauses (see plenty of other links, included that linked above).

We were still surprised that the order block required strings only as well - given it's normally columns, which are allowed on the LHS of where clauses. But certainly changing them to strings fixes up the code for us, so we accept it given the goodness Squeel brings otherwise.

But yeah, Squeel is an API breaker, albeit a breaker of a poorly defined API ! And from the end of the link posted above, it seems those in control of the Active Record API approve, so it's a "safe" breakage I guess.

Having looked over older issues, we concluded that you can't use symbols for the RHS of where clauses (see plenty of other links, included that linked above).

We were still surprised that the order block required strings only as well - given it's normally columns, which are allowed on the LHS of where clauses. But certainly changing them to strings fixes up the code for us, so we accept it given the goodness Squeel brings otherwise.

But yeah, Squeel is an API breaker, albeit a breaker of a poorly defined API ! And from the end of the link posted above, it seems those in control of the Active Record API approve, so it's a "safe" breakage I guess.

@ernie ernie closed this Sep 28, 2012

@zhangxue

This comment has been minimized.

Show comment Hide comment
@zhangxue

zhangxue Sep 29, 2012

How can I not seeing this after 10 mins of search in the closed issues list! Thanks @nami-doc

How can I not seeing this after 10 mins of search in the closed issues list! Thanks @nami-doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment