Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Blocks Blocks Practice Create a Class

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

I don't know what I am doing wrong with the initialize method.

https://teamtreehouse.com/library/ruby-blocks/blocks-practice/create-a-class

For some reason my code is not being accepted and I don't know what the problem is.

monster.rb
class Monster
  def initialize(name, actions)
  @name = name
  @actions={}
  end
end

1 Answer

Hi MaryAnn,

I see two things wrong with your code:

  1. You should indent the code in the initialize code block.
  2. You pass in a parameter "actions" but the @actions variable is initialized as an empty hash -- there's no need to pass it as a parameter.

Hope that helps - please let me know if you have any questions and I'll be happy to help.