Q:

Ruby: NoMethodError

class Member
  def initialize(name,score)
    @name = name.capitalize
    @score = score
  end

  def to_s
    "Hello, my name is #{@name} and my score is #{@score}.  Make sure to give me a good rating!" 
  end
end

class Contest
  def initialize(title)
    @title = title
    @members = [] 
  end

  def join(user)
    @members << user
  end

  def rate_up
    puts "#{@name} just got a rating!" 
    @score += rand(5)
    puts "Now my score is #{@score}.  WHEEEEEEEE"
  end

  def rate_down
    puts "#{@name} just got a rating!" 
    @score -= rand(5)
    puts "Now my score is #{@score}.....WTF"
  end

  def standing
    if @score >= 15
      puts "I got #{@score}!  People love me!" 
    elsif @score < 15
      puts "How did I only get #{@score}?  WTF?  Yall must be blind." 
    end
  end

  def begin
    puts "#{@title} is about to begin!  There are #{@members.size} participants this year!" 
    @members.each do |person|
      person
    end
    @members.each do |person|
      person.rate_up
      person.rate_down
    end
    @members.each do |person|  
      person.standing
    end
  end
end

member1 = Member.new("jh", 6)
member2 = Member.new("is", 8)
member3 = Member.new("sw", 8)
member4 = Member.new("yh", 7)
member5 = Member.new("ws", 6)
member6 = Member.new("sm", 5)

contest1 = Contest.new("BestOfSIS")

contest1.join(member1)
contest1.join(member2)
contest1.join(member3)
contest1.join(member4)
contest1.join(member5)
contest1.join(member6)

contest1.begin

When I run this in Terminal I keep getting the following error:
BestOfSIS is about to begin!  There are 6 participants this year! 
2.rb:48:in `block in begin': undefined method `rate_up' for #<Member:0x007fa04b8340f8 @name="Jh", @score=6> (NoMethodError)
    from 2.rb:47:in `each'
    from 2.rb:47:in `begin'
    from 2.rb:73:in `<main>'

So I'm guessing there's something wrong with the method 'rate_up' but I can't figure out what. 
Another question: Could I have the '@members' array initialized and the 'join' method defined under class 'Member' as opposed to class 'Contest'? 
Thanks in advance! 

A:

your Member class should be
 class Member
  def initialize(name,score)
    @name = name.capitalize
    @score = score
  end

  def to_s
    "Hello, my name is #{@name} and my score is #{@score}.  Make sure to give me a good rating!" 
  end

 def rate_up
    puts "#{@name} just got a rating!" 
    @score += rand(5)
    puts "Now my score is #{@score}.  WHEEEEEEEE"
  end

  def rate_down
    puts "#{@name} just got a rating!" 
    @score -= rand(5)
    puts "Now my score is #{@score}.....WTF"
  end

  def standing
    if @score >= 15
      puts "I got #{@score}!  People love me!" 
    elsif @score < 15
      puts "How did I only get #{@score}?  WTF?  Yall must be blind." 
    end
  end   
end

and your contest class should be
class Contest
  def initialize(title)
    @title = title
    @members = [] 
  end

  def join(user)
    @members << user
  end

def begin
    puts "#{@title} is about to begin!  There are #{@members.size} participants this year!" 
    @members.each do |person|
      person
    end
    @members.each do |person|
      person.rate_up
      person.rate_down
    end
    @members.each do |person|  
      person.standing
    end
  end
end

now
member1 = Member.new("jh", 6)
member2 = Member.new("is", 8)
member3 = Member.new("sw", 8)
member4 = Member.new("yh", 7)
member5 = Member.new("ws", 6)
member6 = Member.new("sm", 5)

contest1 = Contest.new("BestOfSIS")

contest1.join(member1)
contest1.join(member2)
contest1.join(member3)
contest1.join(member4)
contest1.join(member5)
contest1.join(member6)

contest1.begin

and it's getting output
irb(main):127:0> member1 = Member.new("jh", 6)
=> #<Member:0x007f78f175e5d8 @name="Jh", @score=6>
irb(main):128:0> member2 = Member.new("is", 8)
=> #<Member:0x007f78f17428d8 @name="Is", @score=8>
irb(main):129:0> member3 = Member.new("sw", 8)
=> #<Member:0x007f78f1729090 @name="Sw", @score=8>
irb(main):130:0> member4 = Member.new("yh", 7)
=> #<Member:0x007f78f1706f68 @name="Yh", @score=7>
irb(main):131:0> member5 = Member.new("ws", 6)
=> #<Member:0x007f78f16dd078 @name="Ws", @score=6>
irb(main):132:0> member6 = Member.new("sm", 5)
=> #<Member:0x007f78f16b7710 @name="Sm", @score=5>
irb(main):133:0> 
irb(main):134:0* contest1 = Contest.new("BestOfSIS")
=> #<Contest:0x007f78f16967b8 @title="BestOfSIS", @members=[]>
irb(main):135:0> 
irb(main):136:0* contest1.join(member1)
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=6>]
irb(main):137:0> contest1.join(member2)
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=6>, #<Member:0x007f78f17428d8 @name="Is", @score=8>]
irb(main):138:0> contest1.join(member3)
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=6>, #<Member:0x007f78f17428d8 @name="Is", @score=8>, #<Member:0x007f78f1729090 @name="Sw", @score=8>]
irb(main):139:0> contest1.join(member4)
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=6>, #<Member:0x007f78f17428d8 @name="Is", @score=8>, #<Member:0x007f78f1729090 @name="Sw", @score=8>, #<Member:0x007f78f1706f68 @name="Yh", @score=7>]
irb(main):140:0> contest1.join(member5)
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=6>, #<Member:0x007f78f17428d8 @name="Is", @score=8>, #<Member:0x007f78f1729090 @name="Sw", @score=8>, #<Member:0x007f78f1706f68 @name="Yh", @score=7>, #<Member:0x007f78f16dd078 @name="Ws", @score=6>]
irb(main):141:0> contest1.join(member6)
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=6>, #<Member:0x007f78f17428d8 @name="Is", @score=8>, #<Member:0x007f78f1729090 @name="Sw", @score=8>, #<Member:0x007f78f1706f68 @name="Yh", @score=7>, #<Member:0x007f78f16dd078 @name="Ws", @score=6>, #<Member:0x007f78f16b7710 @name="Sm", @score=5>]
irb(main):142:0> 
irb(main):143:0* contest1.begin
BestOfSIS is about to begin!  There are 6 participants this year! 
Jh just got a rating! 
Now my score is 10.  WHEEEEEEEE
Jh just got a rating! 
Now my score is 9.....WTF
Is just got a rating! 
Now my score is 12.  WHEEEEEEEE
Is just got a rating! 
Now my score is 9.....WTF
Sw just got a rating! 
Now my score is 11.  WHEEEEEEEE
Sw just got a rating! 
Now my score is 7.....WTF
Yh just got a rating! 
Now my score is 10.  WHEEEEEEEE
Yh just got a rating! 
Now my score is 6.....WTF
Ws just got a rating! 
Now my score is 10.  WHEEEEEEEE
Ws just got a rating! 
Now my score is 9.....WTF
Sm just got a rating! 
Now my score is 9.  WHEEEEEEEE
Sm just got a rating! 
Now my score is 6.....WTF
How did I only get 9?  WTF?  Yall must be blind. 
How did I only get 9?  WTF?  Yall must be blind. 
How did I only get 7?  WTF?  Yall must be blind. 
How did I only get 6?  WTF?  Yall must be blind. 
How did I only get 9?  WTF?  Yall must be blind. 
How did I only get 6?  WTF?  Yall must be blind. 
=> [#<Member:0x007f78f175e5d8 @name="Jh", @score=9>, #<Member:0x007f78f17428d8 @name="Is", @score=9>, #<Member:0x007f78f1729090 @name="Sw", @score=7>, #<Member:0x007f78f1706f68 @name="Yh", @score=6>, #<Member:0x007f78f16dd078 @name="Ws", @score=9>, #<Member:0x007f78f16b7710 @name="Sm", @score=6>]

