Guest User

Untitled

a guest
Jun 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <table>
  2. <thead>
  3. <tr style="border-bottom: 2px solid black;">
  4. <th> <%= sortable "scode", "School" %></th>
  5. </tr>
  6. </thead>
  7.  
  8. <tbody>
  9. <% @dprojects.where.not(status: "Completed").each do |dproject| %>
  10. <tr>
  11. <td width="20%" class="dotted"><%= dproject.school.dname[0,25] + "..." %></td>
  12. </tr>
  13. <% end %>
  14. </tbody>
  15. </table>
  16.  
  17. class Dproject < ActiveRecord::Base
  18. belongs_to :school, foreign_key: 'scode'
  19. end
  20.  
  21. def index
  22. @dprojects = Dproject.order(params[:sort])
  23. respond_with(@dprojects)
  24. end
  25.  
  26. module DprojectsHelper
  27. def sortable(column, title = nil)
  28. title ||= column.titleize
  29. link_to title, :sort => column
  30. end
  31. end
  32.  
  33. <th> <%= sortable "dproject.school.dname", "School" %></th>
Add Comment
Please, Sign In to add comment