Guest User

Untitled

a guest
Jun 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. ## Controller concerts/verified
  2.  
  3. @concerts = concert.paginate :page => page, :order => order, :per_page => per_page, :conditions => ["active = :active AND verified = :verified AND (end > :now OR start > :now)", {:active => true, :verified => true, :now => Time.zone.now} ]
  4.  
  5. @today = @concerts.collect do |concert|
  6.  
  7. lambda {
  8. if concert.start.present?
  9. return concert if (concert.start.strftime("%Y%m%d") == today)
  10. end
  11. }.call
  12.  
  13. end
  14.  
  15. ## View verified.html.erb
  16.  
  17. <h2>Today</h2>
  18. <%= render :partial => "concert", :layout => "window", :collection => @today %>
  19.  
  20. <h2>All protests</h2>
  21. <%= render :partial => "concert", :layout => "window", :collection => @concerts %>
  22.  
  23. ## Layout _window.html.erb
  24.  
  25. <table>
  26. <tr>
  27. <th>status</th>
  28. <th>options</th>
  29. <th>location</th>
  30. <th>begins</th>
  31. </tr>
  32.  
  33. <%= yield %>
  34.  
  35. </table>
  36.  
  37. </div>
  38.  
  39. <%= will_paginate @concerts %>
Add Comment
Please, Sign In to add comment