True expression still evaluates false

What am I missing about this? I have an expression, which looks to me
to be true, but it still evaluates to false. Here's the code:

  def self.get_stars_from_id_array( ids, ruleset_id )
    templates = Array.new
    ids.each do |i|
      star = find( i )
      logger.info star.ruleset_id
      logger.info ruleset_id
      if star.ruleset_id == ruleset_id then
        templates.push star
      end
    end
    templates
  end

Logger output is
1
1

And yet, star.ruleset_id = ruleset_id always evaluates to false. This
is in my model code. What's going on here?

Thanks!

Chris

Chris wrote:

What am I missing about this? I have an expression, which looks to me
to be true, but it still evaluates to false. Here's the code:

  def self.get_stars_from_id_array( ids, ruleset_id )
    templates = Array.new
    ids.each do |i|
      star = find( i )
      logger.info star.ruleset_id
      logger.info ruleset_id
      if star.ruleset_id == ruleset_id then
        templates.push star
      end
    end
    templates
  end

Logger output is
1

And yet, star.ruleset_id = ruleset_id always evaluates to false. This
is in my model code. What's going on here?

I'm betting that one is a string and one is an integer. Try:

     logger.info star.ruleset_id.inspect
     logger.info ruleset_id.inspect

Pete Yandell
http://notahat.com/