Created
April 17, 2014 12:02
-
-
Save dmitry/10977863 to your computer and use it in GitHub Desktop.
active_admin draper decorator workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::BaseDecorator < Draper::Decorator | |
def self.collection_decorator_class | |
Admin::CollectionDecorator | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::CollectionDecorator < Draper::CollectionDecorator | |
delegate :reorder, | |
:page, | |
:current_page, | |
:total_pages, | |
:limit_value, | |
:total_count, | |
:num_pages | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::PlaceDecorator < Admin::BaseDecorator | |
decorates :place | |
delegate_all | |
def to_param | |
self.id | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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