[Nitro] OG automatically adding Foreign Key constraints

Tim Larson tim at keow.org
Tue Nov 29 09:43:49 EST 2005

On Tue, Nov 29, 2005 at 03:47:26PM +1300, Isaac Devine wrote:
> When using belongs_to and has_many Og isn't generating Foreign Key
> Constraints :
> class Example1
>  property :name, String
>  has_many :children, Example2
> end
> class Example2
>  property :address, String
>  belongs_to :parent, Example1
> end
> What am I doing wrong? 
> Failing that is there a way I specify the constraints?

Because the relation name ":children" does not match the name of
the related class "Example2" Og is getting lost...change your
"has_many" line like this to give it the clue it needs:
  has_many :children, Example2, :foreign_name => :parent

--Tim Larson

More information about the Nitro-general mailing list