Answer the question
In order to leave comments, you need to log in
Choosing partial, what's wrong with creating a post?
The task was to make 2 types of posts: important, less important. Accordingly, they must have different layouts and partials. I started to implement it like this:
In new.html.erb
We get true or false
<%= f.collection_radio_buttons :priority, , :first, :last %>
<% for post in @posts %>
<% if post.priority == true %>
<%= render partial: 'mini_post' %
<% else %>
<%= render post %>
<% end %>
<% end %>
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