Story: sort
This commit is contained in:
parent
5dc024568a
commit
db3384f974
|
@ -315,6 +315,20 @@ class Story < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def fix_bogus_chars
|
||||
# this is needlessly complicated to work around character encoding issues
|
||||
# that arise when doing just self.title.to_s.gsub(160.chr, "")
|
||||
self.title = self.title.to_s.split("").map{|chr|
|
||||
if chr.ord == 160
|
||||
" "
|
||||
else
|
||||
chr
|
||||
end
|
||||
}.join("")
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def generated_markeddown_description
|
||||
Markdowner.to_html(self.description, { :allow_images => true })
|
||||
end
|
||||
|
@ -476,20 +490,6 @@ class Story < ActiveRecord::Base
|
|||
self.user_id, nil, false)
|
||||
end
|
||||
|
||||
def fix_bogus_chars
|
||||
# this is needlessly complicated to work around character encoding issues
|
||||
# that arise when doing just self.title.to_s.gsub(160.chr, "")
|
||||
self.title = self.title.to_s.split("").map{|chr|
|
||||
if chr.ord == 160
|
||||
" "
|
||||
else
|
||||
chr
|
||||
end
|
||||
}.join("")
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def score
|
||||
upvotes - downvotes
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue