Kill trailing whitespace in ruby files
This commit is contained in:
@@ -5,19 +5,19 @@ class IpBan < ActiveRecord::Base
|
||||
validates_presence_of :reason, :creator, :ip_addr
|
||||
validates_format_of :ip_addr, :with => IP_ADDR_REGEX
|
||||
validates_uniqueness_of :ip_addr, :if => lambda {|rec| rec.ip_addr =~ IP_ADDR_REGEX}
|
||||
|
||||
|
||||
def self.is_banned?(ip_addr)
|
||||
exists?(["ip_addr = ?", ip_addr])
|
||||
end
|
||||
|
||||
|
||||
def self.search(params)
|
||||
q = scoped
|
||||
return q if params.blank?
|
||||
|
||||
|
||||
if params[:ip_addr].present?
|
||||
q = q.where("ip_addr = ?", params[:ip_addr])
|
||||
end
|
||||
|
||||
|
||||
q
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class IpBan < ActiveRecord::Base
|
||||
notes = count_by_ip_addr("note_versions", user_ids, "updater_id", "updater_ip_addr")
|
||||
pools = count_by_ip_addr("pool_versions", user_ids, "updater_id", "updater_ip_addr")
|
||||
wiki_pages = count_by_ip_addr("wiki_page_versions", user_ids, "updater_id", "updater_ip_addr")
|
||||
|
||||
|
||||
return {
|
||||
"comments" => comments,
|
||||
"notes" => notes,
|
||||
@@ -34,11 +34,11 @@ class IpBan < ActiveRecord::Base
|
||||
"wiki_pages" => wiki_pages
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
def self.count_by_ip_addr(table, user_ids, user_id_field = "user_id", ip_addr_field = "ip_addr")
|
||||
select_all_sql("SELECT #{ip_addr_field}, count(*) FROM #{table} WHERE #{user_id_field} IN (?) GROUP BY #{ip_addr_field} ORDER BY count(*) DESC", user_ids)
|
||||
end
|
||||
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user