Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rails: Simple Decorator
# frozen_string_literal: true
class ObjectNameDecorator < SimpleDelegator
delegate :class, :is_a?, to: :__getobj__
def self.collection(objects)
objects.map { |group| ObjectNameDecorator.new(object) }
end
private
def h
ActionController::Base.helpers
end
def url
Rails.application.routes.url_helpers
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.