adds rinku gem and auto_link for Comment.body - WIP

This commit is contained in:
David Gil
2015-09-10 14:56:59 +02:00
parent cc7db09aff
commit d6562832e7
3 changed files with 9 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ gem 'omniauth-google-oauth2'
gem 'kaminari' gem 'kaminari'
gem 'ancestry' gem 'ancestry'
gem 'acts-as-taggable-on' gem 'acts-as-taggable-on'
gem "responders" gem 'responders'
gem 'foundation-rails' gem 'foundation-rails'
gem 'foundation_rails_helper' gem 'foundation_rails_helper'
gem 'acts_as_votable' gem 'acts_as_votable'
@@ -40,6 +40,7 @@ gem 'social-share-button'
gem 'initialjs-rails', '0.2.0' gem 'initialjs-rails', '0.2.0'
gem 'unicorn' gem 'unicorn'
gem 'paranoia' gem 'paranoia'
gem 'rinku', require: 'rails_rinku'
gem 'savon' gem 'savon'
gem 'dalli' gem 'dalli'
gem 'rollbar', '~> 2.2.1' gem 'rollbar', '~> 2.2.1'

View File

@@ -294,6 +294,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 3.0)
netrc (~> 0.7) netrc (~> 0.7)
rinku (1.7.3)
rollbar (2.2.1) rollbar (2.2.1)
rspec (3.3.0) rspec (3.3.0)
rspec-core (~> 3.3.0) rspec-core (~> 3.3.0)
@@ -444,6 +445,7 @@ DEPENDENCIES
quiet_assets quiet_assets
rails (= 4.2.4) rails (= 4.2.4)
responders responders
rinku
rollbar (~> 2.2.1) rollbar (~> 2.2.1)
rspec-rails (~> 3.0) rspec-rails (~> 3.0)
sass-rails (~> 5.0) sass-rails (~> 5.0)

View File

@@ -53,6 +53,11 @@ class Comment < ActiveRecord::Base
self.user= author self.user= author
end end
def body
unprocessed = super
unprocessed ? Rinku.auto_link(unprocessed).html_safe : unprocessed
end
def total_votes def total_votes
cached_votes_total cached_votes_total
end end