Story: sort
This commit is contained in:
parent
5dc024568a
commit
db3384f974
|
@ -315,6 +315,20 @@ class Story < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
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
|
def generated_markeddown_description
|
||||||
Markdowner.to_html(self.description, { :allow_images => true })
|
Markdowner.to_html(self.description, { :allow_images => true })
|
||||||
end
|
end
|
||||||
|
@ -476,20 +490,6 @@ class Story < ActiveRecord::Base
|
||||||
self.user_id, nil, false)
|
self.user_id, nil, false)
|
||||||
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 score
|
def score
|
||||||
upvotes - downvotes
|
upvotes - downvotes
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue