Putting presentation logic in controller is a good practice in Ruby?

presentation-layer, ruby, ruby-on-rails, templates

Solution

In my opinion, if the text is the only thing that changes, it doesn't belong in a view. If you needed to restructure the page, that's presentation logic. This, this is just data being different.

Problem

Some recommendation [1] suggest you to use ``` <%= current_user.welcome_message %> ``` instead of ``` <% if current_user.admin? %> <%= current_user.admin_welcome_message %> <% else %> <%= current_user.user_welcome_message %> <% end %> ``` But the problem is you must have the decision logic somewhere in your code. My understanding is putting the decision in `template` is better than `controller` as it make your controller more clean. Is it correct? Are there better way to handle this? http://robots.thoughtbot.com/post/27572137956/tell-dont-ask

Original source