To Examples

RealEstate Example

Source code file: RealEstate/app/views/real_estate_listings/index.html.erb:

<p id="notice"><%= notice %></p>

<h1>Real Estate Listings</h1>

<h3><%= RealEstateListing.count %> results.</h3>

<% @real_estate_listings.each do |r| %>
  <div class="unit">
  <p class="addr"><%= r.address %>, <%= r.city %>, IL</p>

  <p class="saletype"><%= r.sale_type %></p>

  <p class="price"><%= number_to_currency(r.price) %></span></p>

  <p class="specs"><%= r.bedrooms %> beds &bull;
                   <%= r.bathrooms %> baths &bull;
                   <%= r.size %></td> sqft &bull;
                   Built <%= r.year %></span></p>

  <p><%= link_to 'Show Listing Details', r %> |
     <%= link_to 'Edit Listing', edit_real_estate_listing_path(r) %> |
     <%= link_to 'Remove from Database', 
           r, method: :delete, data: { confirm: 'Are you sure?' } %></p>
  </div>
<% end %>

<%= link_to 'New Real Estate Listing', new_real_estate_listing_path %>