David Harper

Joined

1,710 Experience
17 Lessons Completed
0 Questions Solved

Activity

Posted in Adding Scheduled Blog Posts Discussion

Hi Jonathan, I have the same issue.

It works if you use the same css, but if you change the css, it doesn't work:

works for both:

<% if blog_post.draft? %>
  <div class="p-2 rounded bg-gray-100 text-gray-900">Draft</div>
<% elsif blog_post.scheduled? %>
  <div class="p-2 rounded bg-gray-100 text-gray-900">Scheduled</div>
<% end %>

works only for draft:

<% if blog_post.draft? %>
  <div class="p-2 rounded bg-gray-100 text-gray-900">Draft</div>
<% elsif blog_post.scheduled? %>
  <div class="p-2 rounded bg-blue-100 text-gray-900">Scheduled</div>
<% end %>

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.