Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Table name in scoupes #1

Merged
merged 1 commit into from

2 participants

@nodecarter

This commit solve problem like that:
ERROR: column reference "created_at" is ambiguous
when using joins.

@mokevnin mokevnin merged commit e3d4a8d into kaize:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2012
  1. @nodecarter
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/usefull_scopes.rb
View
6 lib/usefull_scopes.rb
@@ -11,11 +11,11 @@ module UsefullScopes
}
attribute_names.each do |a|
- scope "by_#{a}", order("#{a} DESC")
- scope "asc_by_#{a}", order("#{a} ASC")
+ scope "by_#{a}", order("#{quoted_table_name}.#{a} DESC")
+ scope "asc_by_#{a}", order("#{quoted_table_name}.#{a} ASC")
scope "like_by_#{a}", lambda {|term|
quoted_term = connection.quote(term + '%')
- where("lower(#{a}) like #{quoted_term}")
+ where("lower(#{quoted_table_name}.#{a}) like #{quoted_term}")
}
end
end
Something went wrong with that request. Please try again.