improved artist test
This commit is contained in:
@@ -6,6 +6,10 @@ class ArtistVersion < ActiveRecord::Base
|
||||
q = scoped
|
||||
return q if params.blank?
|
||||
|
||||
if params[:name]
|
||||
q = q.where("name like ? escape E'\\\\'", params[:name].to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
if params[:artist_id]
|
||||
q = q.where("artist_id = ?", params[:artist_id].to_i)
|
||||
end
|
||||
|
||||
@@ -19,10 +19,18 @@ class Ban < ActiveRecord::Base
|
||||
q = q.where("banner_id = (select _.id from users _ where lower(_.name) = ?)", params[:banner_name].downcase)
|
||||
end
|
||||
|
||||
if params[:banner_id]
|
||||
q = q.where("banner_id = ?", params[:banner_id].to_i)
|
||||
end
|
||||
|
||||
if params[:user_name]
|
||||
q = q.where("user_id = (select _.id from users _ where lower(_.name) = ?)", params[:user_name].downcase)
|
||||
end
|
||||
|
||||
if params[:user_id]
|
||||
q = q.where("user_id = ?", params[:user_id].to_i)
|
||||
end
|
||||
|
||||
q
|
||||
end
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class CommentVote < ActiveRecord::Base
|
||||
validates_inclusion_of :score, :in => [-1, 1], :message => "must be 1 or -1"
|
||||
|
||||
def self.prune!
|
||||
destroy_all(["created_at < ?", 14.days.ago])
|
||||
destroy_all("created_at < ?", 14.days.ago)
|
||||
end
|
||||
|
||||
def validate_user_can_vote
|
||||
|
||||
Reference in New Issue
Block a user