Guest User

Untitled

a guest
Jan 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <% if notice%>
  2. <p id="notice"> <%= notice%></p>
  3. <%end%>
  4.  
  5. <h1>All Priorities</h1>
  6.  
  7. <%= form_tag store_path, :method => 'get' do %>
  8. <p>
  9. <%=text_field_tag :search , params[:search]%>
  10. <%= submit_tag "Search", :name=> nil%>
  11. </p>
  12. <%end%>
  13.  
  14. <% if @buildings.present? %>
  15. <% @buildings.each do |building| %>
  16. <div class="entry">
  17. <div class="img">
  18. <%= image_tag (building.photo.url)%></div>
  19. <div class=" disc">
  20. <h3>Name of the Bulding: <%= building.title %></h3>
  21. <h4>Status: <%= building.status %></h4>
  22. Info: <%=sanitize(building.description)%>
  23. <div class="price_line">
  24. <span class="price">Price: <%= sprintf("€ %0.02f",building.price)%></span><br/>
  25. <div class="button">
  26. <%= button_to("I want to see it", {:controller => "seeits", :action => "new", :building_id => building.id})%></div>
  27.  
  28. </div>
  29.  
  30. <div class="pages">
  31. <%= will_paginate @buildings %></p>
  32. </div>
  33.  
  34. </div>
  35. <% end %>
  36.  
  37. </div>
  38.  
  39. <% else %> does not much try another name<% end %>
  40.  
  41. def index
  42.  
  43. @buildings = Building.all
  44.  
  45. respond_to do |format|
  46. format.html # index.html.erb
  47. format.json { render json: @buildings }
  48. end
  49.  
  50. end
  51.  
  52.  
  53. # GET /buildings/1
  54. # GET /buildings/1.json
  55. def show
  56. @building = Building.find(params[:id])
  57.  
  58. respond_to do |format|
  59. format.html # show.html.erb
  60. format.json { render json: @building }
  61. end
  62. end
  63.  
  64. @buildings.select{|b| b.status == "for sale"}.each do |building|
  65.  
  66. @buildings = Building.where("status = 'for sale'")
  67.  
  68. class Building < ActiveRecord::Base
  69. ...
  70. scope :for_sale, where(:status => "for sale")
  71. ...
  72. end
  73.  
  74. @buildings = Building.for_sale
Add Comment
Please, Sign In to add comment