I'm just getting my sea legs and I have run into something I think is pretty strange. Why is it that I sometimes get an empty array value when I iterate over an answer set from an activeRecord query? This code rocked along through several cycles until it ran aground:
@tags = Tag.find_by_sql ["select t.* from tags t, entry_tags et where t.id = et.tag_id and et.entry_id = ?", self.id ] @tags.each do |tag| puts "tag:#{tag.inspect}" tagWords = tag.word.split ..... end
I put the inspect in when I got the undefined method error and ran again to discover:
tag: gator:66:in `tags': undefined method `word' for :Array (NoMethodError)
anyone got a clue? what does this mean and how do I get over it?
thanks in advance! James