Kill trailing whitespace in ruby files
This commit is contained in:
@@ -10,16 +10,16 @@ class WikiPage < ActiveRecord::Base
|
||||
has_one :tag, :foreign_key => "name", :primary_key => "title"
|
||||
has_one :artist, :foreign_key => "name", :primary_key => "title"
|
||||
has_many :versions, :class_name => "WikiPageVersion", :dependent => :destroy, :order => "wiki_page_versions.id ASC"
|
||||
|
||||
|
||||
module SearchMethods
|
||||
def titled(title)
|
||||
where("title = ?", title.downcase.tr(" ", "_"))
|
||||
end
|
||||
|
||||
|
||||
def recent
|
||||
order("updated_at DESC").limit(25)
|
||||
end
|
||||
|
||||
|
||||
def body_matches(query)
|
||||
where("body_index @@ plainto_tsquery(?)", query.to_escaped_for_tsquery_split)
|
||||
end
|
||||
@@ -35,15 +35,15 @@ class WikiPage < ActiveRecord::Base
|
||||
if params[:creator_id].present?
|
||||
q = q.where("creator_id = ?", params[:creator_id])
|
||||
end
|
||||
|
||||
|
||||
if params[:body_matches].present?
|
||||
q = q.body_matches(params[:body_matches])
|
||||
end
|
||||
|
||||
|
||||
if params[:creator_name].present?
|
||||
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].downcase)
|
||||
end
|
||||
|
||||
|
||||
if params[:sort] == "time" || params[:sort] == "Date"
|
||||
q = q.order("updated_at desc")
|
||||
end
|
||||
@@ -51,7 +51,7 @@ class WikiPage < ActiveRecord::Base
|
||||
q
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module ApiMethods
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
@@ -64,7 +64,7 @@ class WikiPage < ActiveRecord::Base
|
||||
hash = super(options)
|
||||
hash
|
||||
end
|
||||
|
||||
|
||||
def to_xml(options = {}, &block)
|
||||
options ||= {}
|
||||
options[:procs] ||= []
|
||||
@@ -72,27 +72,27 @@ class WikiPage < ActiveRecord::Base
|
||||
super(options, &block)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
extend SearchMethods
|
||||
include ApiMethods
|
||||
|
||||
|
||||
def self.find_title_and_id(title)
|
||||
titled(title).select("title, id").first
|
||||
end
|
||||
|
||||
|
||||
def validate_locker_is_janitor
|
||||
if is_locked_changed? && !CurrentUser.is_janitor?
|
||||
errors.add(:is_locked, "can be modified by janitors only")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def revert_to(version)
|
||||
self.title = version.title
|
||||
self.body = version.body
|
||||
self.is_locked = version.is_locked
|
||||
end
|
||||
|
||||
|
||||
def revert_to!(version)
|
||||
revert_to(version)
|
||||
save!
|
||||
@@ -105,7 +105,7 @@ class WikiPage < ActiveRecord::Base
|
||||
def creator_name
|
||||
User.id_to_name(creator_id).tr("_", " ")
|
||||
end
|
||||
|
||||
|
||||
def category_name
|
||||
Tag.category_for(title)
|
||||
end
|
||||
@@ -113,7 +113,7 @@ class WikiPage < ActiveRecord::Base
|
||||
def pretty_title
|
||||
title.tr("_", " ")
|
||||
end
|
||||
|
||||
|
||||
def create_version
|
||||
if title_changed? || body_changed? || is_locked_changed?
|
||||
versions.create(
|
||||
@@ -125,19 +125,19 @@ class WikiPage < ActiveRecord::Base
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.user.id
|
||||
end
|
||||
|
||||
|
||||
def post_set
|
||||
@post_set ||= PostSets::WikiPage.new(title, 1, 4)
|
||||
end
|
||||
|
||||
|
||||
def presenter
|
||||
@presenter ||= WikiPagePresenter.new(self)
|
||||
end
|
||||
|
||||
|
||||
def tags
|
||||
body.scan(/\[\[(.+?)\]\]/).flatten.map do |match|
|
||||
if match =~ /^(.+?)\|(.+)/
|
||||
|
||||
Reference in New Issue
Block a user