Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from nodecarter/master

Table name in scoupes
  • Loading branch information...
commit e3d4a8d53b7d820c785f25198e8544e124af1aa8 2 parents 21adb12 + 0be03ab
@mokevnin mokevnin 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.