How to create a line space in a Rails partial view? -


in index.html.erb view, have following render display each , every flight (without doing .each:

<%= render @flights %> 

however, have flights partial written, flights listed side-by-side. want 1 flight listed per line. how create line space after each flight?

<%= radio_button_tag :flight_id, flight.id %> <%= flight.id %> <%= flight.date.strftime("%b %d, %y")  %> <%= flight.date.strftime('%i:%m:%s %p') %> <%= flight.from_airport.code %> <%= flight.to_airport.code %> <%= distance_of_time_in_words(flight.duration) %> 

why not use tables?

<table>   <%= render @flights %> </table> 

and in partial write

<tr>   <td><%= radio_button_tag :flight_id, flight.id %></td>   <td><%= flight.id %></td>   <td><%= flight.date.strftime("%b %d, %y")  %></td>   <td><%= flight.date.strftime('%i:%m:%s %p') %></td>   <td><%= flight.from_airport.code %></td>   <td><%= flight.to_airport.code %></td>   <td><%= distance_of_time_in_words(flight.duration) %></td> </tr> 

arrgghhhh typing, , error-prone. educational purposes, why not use haml?

%table   = render @flights 

in partial:

%tr   %td= radio_button_tag :flight_id, flight.id    %td= flight.id    %td= flight.date.strftime("%b %d, %y")     %td= flight.date.strftime('%i:%m:%s %p')    %td= flight.from_airport.code    %td= flight.to_airport.code    %td= distance_of_time_in_words(flight.duration)  

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -