Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table>
- <thead>
- <tr style="border-bottom: 2px solid black;">
- <th> <%= sortable "scode", "School" %></th>
- </tr>
- </thead>
- <tbody>
- <% @dprojects.where.not(status: "Completed").each do |dproject| %>
- <tr>
- <td width="20%" class="dotted"><%= dproject.school.dname[0,25] + "..." %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- class Dproject < ActiveRecord::Base
- belongs_to :school, foreign_key: 'scode'
- end
- def index
- @dprojects = Dproject.order(params[:sort])
- respond_with(@dprojects)
- end
- module DprojectsHelper
- def sortable(column, title = nil)
- title ||= column.titleize
- link_to title, :sort => column
- end
- end
- <th> <%= sortable "dproject.school.dname", "School" %></th>
Add Comment
Please, Sign In to add comment