0.10.x series changed the default for #belongs_to to :required =>
true. This means that by default the columns will be automigrated with
a NOT NULL constraint. If you need the old behavior, just do:
belongs_to :post, :required => false. And in case you're wondering,
0.10.2 deprecated :nullable => false and now uses :required => true to
the same effect.

For a rather complete guide about what changed see
http://sick.snusnu.info/2009/06/03/migrating-to-datamapper-0100/
Could be that a few deprecation warnings are missing

On Tue, Dec 29, 2009 at 04:10, MarkMT <[email protected]> wrote:
> If I declare a model that 'belongs_to' another, create an instance of
> it and try to save it without a foreign key value I get an exception
> stating that the foreign key field doesn't have a default value.
> Here's an example - http://gist.github.com/265117 . The console output
> indicates that the table is being created with a non null constraint
> on the foreign key.
>
> Surely this hasn't always been the case? This is breaking an app of
> mine that has been working perfectly fine. Am I missing something?
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.


Reply via email to