Closed mavenastic closed 12 years ago
It is a strange behaviour!
even the new, save
method is not working (you have ["project_id", nil]
)
we have to take a closer look at it, but for now, my preferred method to create a postable
in project
is this:
# p = some project
Bookmark.create project: p, title: 'foo', ...
Thank you for the workaround, this indeed works:
Bookmark.create(project_id: p.id, title: "El Diablo", url: "http://eldiablo.es")
I'll try to troubleshoot and will post if I find something interesting; will use the workaround in the mean time.
Thanks!
Disclaimer: This issue might be related to https://github.com/hzamani/acts_as_relation/issues/9, although I'm not sure it is.
Let's say I have a Project model that has many items, the Item model being polymorphic.
Now, when I define a Bookmark model like so:
And try to create one for a specific project in the console, it fails with a validation error on the common attribute, which was provided in the create statement:
However, if I use
new
thensave
, it works flawlessly:I take it that the parent class methods are made available to the child model object during its initialization. Is there a workaround to this issue? Could it be related to issue #9?
Thanks in advance.