Permalink
Browse files

時間割の上に 参加面接時間/最低面接時間 を表示 #3

  • Loading branch information...
1 parent 5ae03b7 commit bef1c56ec84335934cfa591f966acd0b7aab44fe @imaz committed May 17, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −0 app/controllers/attendances_controller.rb
  2. +1 −0 app/models/subject.rb
  3. +9 −1 app/views/attendances/index.html.haml
@@ -4,6 +4,7 @@ class AttendancesController < ApplicationController
def index
@attendances = Attendance.all
@calendars = Calendar.all
+ @subjects = Subject.all
respond_to do |format|
format.html # index.html.erb
View
@@ -1,2 +1,3 @@
class Subject < ActiveRecord::Base
+ has_many :attendances, :dependent => :destroy
end
@@ -2,6 +2,15 @@
%table{border:"1"}
%tr
+ -@subjects.each do |subject|
+ %th= subject.name
+ %tr
+ -@subjects.each do |subject|
+ %td= subject.attendances.count.to_s + "/" + subject.attendance.to_s
+%br
+
+%table{border:"1"}
+ %tr
%th
%th 1
%th 2
@@ -18,7 +27,6 @@
- attendance = calendar.attendances.select {|a| a.period == i }.first
- if attendance
= attendance.subject.name
-
%br
= link_to 'New Attendance', new_attendance_path

0 comments on commit bef1c56

Please sign in to comment.