Answer the question
In order to leave comments, you need to log in
How to check condition in Slim (Rails)?
Hello, I want to check if the user is registered and display a button for him, and vice versa. In short, you need to check the condition, but I haven’t figured out the template engine yet, I’m just experimenting. Help me please.
- if user_signed_in?
.title
= link_to 'Новый пост', new_post_path, class: 'btn btn-success'
- else
.title_else
p "Войдите или "
= link_to 'Зарегистрируйтесь', new_user_registration_path
p " для того что бы написать новый пост"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question