Class: RailsInfo::DataPresenter

Inherits:
Presenter show all
Defined in:
app/presenters/rails_info/data_presenter.rb

Instance Method Summary collapse

Methods inherited from Presenter

#initialize, #subject=

Constructor Details

This class inherits a constructor from RailsInfo::Presenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RailsInfo::Presenter

Instance Method Details

#actionsObject



2
3
4
# File 'app/presenters/rails_info/data_presenter.rb', line 2

def actions
   :div, submit_tag(I18n.t('rails_info.data.general.delete'), name: 'delete')
end

#last_objectsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/presenters/rails_info/data_presenter.rb', line 6

def last_objects
  return @last_objects if @last_objects
  
  @last_objects = ::RailsInfo::Data.new.last_objects
  
  if @last_objects.flatten.none?
    I18n.t('rails_info.data.index.no_models_found')
  else
    @last_objects.map{|row_set| ::RailsInfo::Data::RowSetPresenter.new(subject, row_set: row_set) }.each do |row_set_presenter|
      yield row_set_presenter
    end
    
    ""
  end
end