Note we're excluding a few files: * Configuration files that weren't generated by us * Migration files that weren't generated by us * The Gemfile, since it includes an important comment that must be on the same line as the gem declaration * The Budget::Stats class, since the heading statistics are a mess and having shorter lines would require a lot of refactoring
21 lines
489 B
Ruby
21 lines
489 B
Ruby
class Relationable::RelatedListComponent < ApplicationComponent
|
|
attr_reader :relationable
|
|
delegate :current_user, to: :helpers
|
|
|
|
def initialize(relationable)
|
|
@relationable = relationable
|
|
end
|
|
|
|
def render?
|
|
related_contents.present?
|
|
end
|
|
|
|
private
|
|
|
|
def related_contents
|
|
@related_contents ||= Kaminari.paginate_array(relationable.relationed_contents)
|
|
.page(params[:page])
|
|
.per(5)
|
|
end
|
|
end
|