Topic: has_many/belongs_to relationship issues
I've got two tables in a MS SQL database:
ParID : int (pk)
ChildID : int (pk)
ChildParent : int (fk)
Their simplified models look like this:
belongs_to :parent, :foreign_key => :ParID, :inverse_of => :children
has_many :children, :class_name => :Child, :foreign_key => :ChildParent, :dependent => :delete_all, :inverse_of => :parent
I don't appear to be getting any errors, but the relationship does not load. If I run the following code in the view page for Parent, it returns nil when I know there are records that exist in the database for that relationship.
<% logger.debug @parent.children.inspect %>
I have similar relationships defined that work perfectly. Any direction would be greatly appreciated, I've been working on this little problem for two days now.