Skip to content

Instantly share code, notes, and snippets.

@dmitry
Created April 17, 2014 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry/10977863 to your computer and use it in GitHub Desktop.
Save dmitry/10977863 to your computer and use it in GitHub Desktop.
active_admin draper decorator workflow
class Admin::BaseDecorator < Draper::Decorator
def self.collection_decorator_class
Admin::CollectionDecorator
end
end
class Admin::CollectionDecorator < Draper::CollectionDecorator
delegate :reorder,
:page,
:current_page,
:total_pages,
:limit_value,
:total_count,
:num_pages
end
class Admin::PlaceDecorator < Admin::BaseDecorator
decorates :place
delegate_all
def to_param
self.id
end
end
ActiveAdmin.register Place do
decorate_with Admin::PlaceDecorator
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment