[Nitro] sqlite errors

itsme213 itsme213 at hotmail.com
Tue Nov 29 11:06:10 EST 2005


Thanks George.

I am a bit confused by some non-DRY parts:

class A
  has_many :bs, B, :foreign_name, :inv_bs # (1)
end

class B
  belongs_to :inv_bs, A # (2) <-- WHY NEEDED?
end

With sqlite (2) is needed, but isn't it redundant with (1)?

Also, kirby works without (2). It would be good if the different stores used 
consistent ORM macros at the user-level.

A further thought: could both belongs_to and foreign_key to be automatically 
generated by Og (with some suitable unambiguous naming rule) if it is not 
explicitly specified by the user? After all, the has_many commits to a 1-N 
relation. The user may not have any need to name or refer to the inverse, 
and this would let the user declare just the object-model part needed.

Then
======================
class A
  has_many :good_Bs, B
  has_many :bad_Bs, B
end

class B
end
-------------
could be equivalent to:
class A
  has_many :good_Bs, B, :foreign_name=> :inv_good_Bs_A
  has_many :good_Bs, B, :foreign_name=> :inv_bad_Bs_A
end

class B
end
======================

Just a thought.


----- Original Message ----- 
From: "George Moschovitis" <george.moschovitis at gmail.com>
To: "General discussion about Nitro" <nitro-general at rubyforge.org>
Sent: Tuesday, November 29, 2005 2:07 AM
Subject: Re: [Nitro] sqlite errors


> yeah,
>
> add:
>
> class A
>  belongs_to B
>  ...
> end
>
>
> On 11/28/05, itsme213 <itsme213 at hotmail.com> wrote:
>> I get errors using sqlite with og 0.25. Am I doing something wrong?
>>
>> Thanks!
>>
>> ---------------
>>
>> require 'og'
>>
>> class A
>>  property :name, String
>>  def initialize(n)
>>   @name = n
>>  end
>> end
>>
>> class B
>>  property :name, String
>>  has_many :posts, A
>> end
>>



More information about the Nitro-general mailing list