Monday, December 21, 2015

How to include URL Helpers in Decorators in Rails 4.2.5

Add :
 
include Rails.application.routes.url_helpers
 
to the decorator. For example:
 
class BugsDecorator < ApplicationDecorator
  include Rails.application.routes.url_helpers
end