How to deal with user rights in the views ?

Nicolas Blanco wrote:

This is a question about the best way to develop an application with
different user rights.

According to the user rights, i want to display the same views but with
small differences (like additional buttons if the user is an admin,
moderator, etc).

The problem (I think) is that I've put a lot of logic in my views (if
then... else... etc). is that the best way to deal with user rights in
the views?

Thanks for your advices.

You could use helpers.

some pseudocode:

admin_link_to { :action => delete }

def admin_link_to(options)
  if @user.has_role('Admin') #or however your rights system works ...