Search code examples
cssruby-on-railsruby-on-rails-5

Rails Link_to text but not display Class


I have use Rails link_to and CSS class without any problem, but I think I am using right but it not show at all

as I am trying to create CSS as Accept ( green background color) and Decline ( red background color)

as simple based text

<p class="text-center"><%= reservation.status %></p>
   <div class="form-inline">
      <% if reservation.Waiting? %>
      <%= link_to approve_reservation_path(reservation), class:"btn-declined", method: :post do %>  <% end %>
      <%= link_to decline_reservation_path(reservation), class:"btn-approved", method: :post do %>  <% end %>
      <% end %>
  </div>

as have used different way but no CSS display only text

enter image description here

the console log shows no CSS for accepting and decline on it

enter image description here

CSS code

enter image description here

what is an alternative way to get display CSS on it


Solution

  • <p class="text-center"><%= reservation.status %></p>
     <div class="form-inline">
      <% if reservation.Waiting? %>
      <%= link_to "Approve", approve_reservation_path(reservation), class:"btn-declined", method: :post %>
      <%= link_to "Decline", decline_reservation_path(reservation), class:"btn-approved", method: :post %>
      <% end %>
    

    the links will only show if <% if reservation.Waiting? %> becomes true.