On Mar 12, 2013, at 11:22 AM, bretweinraub wrote:
>
> I've tested this in 2.0.0.pre6 ... and upgrading to 2.0.0 hasn't changed
> things for me (rails 3.2.12/ruby 1.9.3-p194)
>
> If you have this:
>
> class MyModel < ActiveRecord::Base
>
> fields do
> customer_id :integer, :default => false
> end
>
> belongs_to :customer
> end
>
> the hobo fields migration generator ignores "default => false".
>
> I've got a few ideas about why this is, but one's thing for certain:
>
> You can't have a foreign key field with a not null constraint on it and still
> use hobo fields migration generator.
>
Try this:
class MyModel < ActiveRecord::Base
fields do
...declare whatever else...
end
belongs_to :customer, :null => false
end
Not apparently documented, but a quick peek at the source shows that it should
do what you want.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.