Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.