Forum: Ruby on Rails Creating/Storing Attendance Records for different Rooms.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
37458f666d90dc342c3dc45cb64d96ff?d=identicon&s=25 n0d dy (noddy)
on 2009-03-02 15:08
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.
This topic is locked and can not be replied to.