Module: HumanValue::Extensions::Carrierwave
- Defined in:
- lib/human_value/extensions/carrierwave.rb
Class Method Summary collapse
Class Method Details
.load ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/human_value/extensions/carrierwave.rb', line 4 def self.load HumanValue.humanize :image do test do |v| v.respond_to?(:content_type) && v.content_type.to_s.starts_with?("image") end coerce { |v| "<img src='#{v}'>".html_safe } end HumanValue.humanize :file do test { |v| v.respond_to?(:content_type) } coerce { |v| "<a href='#{v}'>#{v.filename}</a>".html_safe } end end |