E
E
eldar_web2018-03-09 18:24:47
Ruby on Rails
eldar_web, 2018-03-09 18:24:47

What's the point of using Presenters in Ruby on Rails?

For example, if I can shove all the controller processing into my service object, then why use Presenters?
Example:

def index
  @todo = Todo.new 
end

The Todo class is a service object that contains the processing of an action, and I will insert data into the view through this object.
QUESTION: if you can do this, then why use Presenters?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artur Bordenyuk, 2018-03-10
@HighQuality

Presenter - pattern

D
Dmitri Sinitsa, 2018-03-10
@unabl4

Service Object (aka Interactor, aka Use Case) should not have the slightest relation to the view layer at all - they exist at different levels of the hierarchy.
Read Clean Architecture.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question