I’m developing a small rails application for my local community centre
to help them record their attendance. The community centre (building)
has several rooms and each room is used on a daily basis for numerous
activities. I have the following setup:
#building.rb
class Building < ActiveRecord::Base
has_many :rooms
end
#room.rb
class Room < ActiveRecord::Base
belongs_to :building
has_many :attendances
end
#attendance.rb
class Attendance < ActiveRecord::Base
belongs_to :room
has_many :attendees
end
#attendee.rb
class Attendee < ActiveRecord::Base
belongs_to :attendance
end
I assume the following is an efficient way of recording the attendance
figures for each room? I create a new attendance record for each of the
rooms (daily) and then add the attendees to the attendance record. (This
is working fine.)
In the new attendance form I have a date select and room select (listing
all of the rooms within the building). As they have several rooms
creating new records for each is a tedious process - I would like to
have one form which you can select the date and once submitted it will
create a new attendance record for all rooms in the building. A step
further would be to have the rails app create the attendance records
automatically each day. I would be grateful of your thoughts on how best
this could be achieved.