[Nitro] HasManyCollection#each

itsme213 itsme213 at hotmail.com
Fri Nov 25 21:20:28 EST 2005


I meant
  b.as.each {|a| puts a.name}
not
  B.new.as.each ...


----- Original Message ----- 
From: "itsme213" <itsme213 at hotmail.com>
To: "General discussion about Nitro" <nitro-general at rubyforge.org>
Sent: Friday, November 25, 2005 8:18 PM
Subject: [Nitro] HasManyCollection#each


> Given:
> 
> class A
>  property :name, String
>  def initialize n
>    @name = n
>  end
> end
> 
> class B
>  property :name, String
>  has_many :as, A
> end
> 
> b = B.new
> b.add_a(A.new "a1")
> b.add_a(A.new "a2")
> 
> B.new.as.each {|a| puts a.name}
> 
> #=> I see nothing. Should I see a1, a2?
> 
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>



More information about the Nitro-general mailing list