From: Christopher Dicely Date: 2009-05-08T03:49:28+09:00 Subject: Re: n00b: code logic (probably a 1-min-question) On Thu, May 7, 2009 at 9:31 AM, Tom Ha wrote: > Hi there, > > Why do I get 'true' when: > - I call: @agency.all_agents_done? and > - @gency has at least 3 Agents > > > The Agency model is: > ==================== > >  class Agency < ActiveRecord::Base >    has_many :agents > >    def all_agents_done?     # (don't look for any real sense in this > method...) >      i=0 >      self.agents do |agent| # (@gency has at least 3 Agents...) >        i=i+1 if (1 == 1) >      end > >      if i == 0 >        true >      else >        false >      end >    end >  end > > > > Thanks for any hint! > Tom > -- > Posted via http://www.ruby-forum.com/. In the question at the tops and the comment, you alternate between @agency and @gency -- if this inconsistency exists in the method that has the instance variable(s) @agency and/or @gency that is calling this code, that could be part of the source of the problem.