Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix problem that caused when using 'joins'

  • Loading branch information...
commit 0be03abc5444740e1a6a9293dffc7db510ef6e7f 1 parent 21adb12
@nodecarter nodecarter authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.