Skip to content

Instantly share code, notes, and snippets.

@lightcap
Created March 15, 2010 16:38
Show Gist options
  • Save lightcap/333023 to your computer and use it in GitHub Desktop.
Save lightcap/333023 to your computer and use it in GitHub Desktop.
class MonitorPoll < ActiveRecord::Base
set_table_name :inverter_monitor_polls
belongs_to :inverter
has_one :inverter, :foreign_key => :last_poll_id
end
class Inverter < ActiveRecord::Base
has_many :monitor_polls
belongs_to :last_poll, :foreign_key => "last_poll_id", :class_name => "MonitorPoll"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment