SuperAwesomeSquad/Yet-Another-Monitoring-Program — pull request #3 by allynfolksjr (2013-04-15 00:16:44+00:00)
Title: Merge initial model work upstream

After going through various situations in my mind and trying out quite a few, I eventually decided to build our models based off of the railscast on polymorphic association. Essentially, there will be a BaseMonitor object that will belong to a specific Monitor Model (such as PingMonitor or FileMonitor). BaseMonitor will delegate most functionality to its owner, but will also be owned by a User. You can easily do something like this in the Console:

rails c
pm = PingMonitor.new(hostname: 'google.com')
pm.BaseMonitor.user = User.find(id)
pm.save
User.find(id).BaseMonitors

Tests will be coming shortly