Kill trailing whitespace in ruby files

This commit is contained in:
小太
2013-03-19 23:10:10 +11:00
parent c107f96cec
commit cba839ba76
319 changed files with 2710 additions and 2710 deletions

View File

@@ -2,38 +2,38 @@ class PostVersion < ActiveRecord::Base
belongs_to :post
belongs_to :updater, :class_name => "User"
before_validation :initialize_updater
module SearchMethods
def for_user(user_id)
where("updater_id = ?", user_id)
end
def updater_name(name)
where("updater_id = (select _.id from users _ where lower(_.name) = ?)", name.downcase)
end
def search(params)
q = scoped
params = {} if params.blank?
if params[:updater_name].present?
q = q.updater_name(params[:updater_name])
end
if params[:updater_id].present?
q = q.where("updater_id = ?", params[:updater_id].to_i)
end
if params[:post_id].present?
q = q.where("post_id = ?", params[:post_id].to_i)
end
q
end
end
extend SearchMethods
def self.create_from_post(post)
if post.created_at == post.updated_at
create_from_created_post(post)
@@ -41,20 +41,20 @@ class PostVersion < ActiveRecord::Base
create_from_updated_post(post)
end
end
def initialize_updater
self.updater_id = CurrentUser.id
self.updater_ip_addr = CurrentUser.ip_addr
end
def tag_array
@tag_array ||= tags.scan(/\S+/)
end
def presenter
PostVersionPresenter.new(self)
end
def reload
@tag_array = nil
super
@@ -70,7 +70,7 @@ class PostVersion < ActiveRecord::Base
end
return diffs
end
def diff(version)
latest_tags = post.tag_array
new_tags = tag_array
@@ -92,11 +92,11 @@ class PostVersion < ActiveRecord::Base
:obsolete_removed_tags => old_tags & latest_tags,
}
end
def previous
PostVersion.where("post_id = ? and updated_at < ?", post_id, updated_at).order("updated_at desc").first
end
def truncated_source
source.gsub(/^http:\/\//, "").sub(/\/.+/, "")
end