Sha256: c99c37e2cd54d2ab780af8fc04e29da6f79b0b3873ca7ae2f904c8d9aa66bfde

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

# inspired by https://github.com/activeadmin/activeadmin/blob/a180c76f17480715948bff2ead827f338d95a835/spec/support/templates/post_decorator.rb
class ArticlePresenter < DelegateClass(Article)
  include ActiveadminPoroDecorator

  class << self
    delegate :all, :arel_table, :find_by_sql, :columns, :connection,\
             :unscoped, :table_name, :primary_key, to: Article

    def model_name
      ActiveModel::Name.new Article
    end

    def build_default_scope
      Article.send(:build_default_scope)
    end
  end
  
  def hello
    "Hello, #{title}"
  end

  def link_title
    helpers.link_to(id, url_helpers.admin_article_path(self))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin-poro-decorator-0.1.0 spec/support/dummy/app/presenters/article_presenter.rb