Note that there are some explanatory texts on larger screens.

plurals
  1. POspecific view on ruby on rails
    primarykey
    data
    text
    <p>ok here is the thing i have the view store that shows all the buildings. all i want to do is to show me only the buildings with the status "for sale" </p> <p>in views store i have:</p> <pre><code>&lt;% if notice%&gt; &lt;p id="notice"&gt; &lt;%= notice%&gt;&lt;/p&gt; &lt;%end%&gt; &lt;h1&gt;All Priorities&lt;/h1&gt; &lt;%= form_tag store_path, :method =&gt; 'get' do %&gt; &lt;p&gt; &lt;%=text_field_tag :search , params[:search]%&gt; &lt;%= submit_tag "Search", :name=&gt; nil%&gt; &lt;/p&gt; &lt;%end%&gt; &lt;% if @buildings.present? %&gt; &lt;% @buildings.each do |building| %&gt; &lt;div class="entry"&gt; &lt;div class="img"&gt; &lt;%= image_tag (building.photo.url)%&gt;&lt;/div&gt; &lt;div class=" disc"&gt; &lt;h3&gt;Name of the Bulding: &lt;%= building.title %&gt;&lt;/h3&gt; &lt;h4&gt;Status: &lt;%= building.status %&gt;&lt;/h4&gt; Info: &lt;%=sanitize(building.description)%&gt; &lt;div class="price_line"&gt; &lt;span class="price"&gt;Price: &lt;%= sprintf("€ %0.02f",building.price)%&gt;&lt;/span&gt;&lt;br/&gt; &lt;div class="button"&gt; &lt;%= button_to("I want to see it", {:controller =&gt; "seeits", :action =&gt; "new", :building_id =&gt; building.id})%&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="pages"&gt; &lt;%= will_paginate @buildings %&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; &lt;/div&gt; &lt;% else %&gt; does not much try another name&lt;% end %&gt; </code></pre> <p>in controller>buildings_controller</p> <pre><code> def index @buildings = Building.all respond_to do |format| format.html # index.html.erb format.json { render json: @buildings } end end # GET /buildings/1 # GET /buildings/1.json def show @building = Building.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @building } end end </code></pre> <p>is there to do it with IF statement ? or i have to change <code>&lt;% @buildings.each do |building| %&gt;</code> ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload