Skip to content

Instantly share code, notes, and snippets.

@Fivell
Created November 15, 2014 12:12
Show Gist options
  • Select an option

  • Save Fivell/81921da21f3d92dc0d22 to your computer and use it in GitHub Desktop.

Select an option

Save Fivell/81921da21f3d92dc0d22 to your computer and use it in GitHub Desktop.
AA Base decorator
class BaseDecorator < Draper::Decorator
delegate_all
include Rails.application.routes.url_helpers
def arbre(&block)
Arbre::Context.new({}, self, &block).to_s #<<<--pass self as second argument
end
def comments_count
ActiveAdmin::Comment.where(resource_id: self.model.id.to_s, resource_type: self.model.class.to_s).count
end
end
@Fivell

Fivell commented Sep 2, 2015

Copy link
Copy Markdown
Author

@cpfather, did you try to include ActionView::Helpers::NumberHelper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment