Wednesday, February 8, 2012

Make ActiveRecord::Base#create respect the :type attribute

I think I've needed and implemented this twice now, so let's make a post about it.

The problem occurs when you are using f.fields_for and nested forms, as per these railscasts, and the nested objects are using STI.

(Will leave a more detailed explanation for future posts).

Update 1: Even though this works as described, I don't think it solves my problem. Will post again if I figure it out...

Update 2: Found this which is I think what I was using last time I had this problem... :S


No comments: