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 trialMaryAnn Eleanya
8,626 PointsI 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.
class Monster
def initialize(name, actions)
@name = name
@actions={}
end
end
1 Answer
Chase Stevens
11,056 PointsHi MaryAnn,
I see two things wrong with your code:
- You should indent the code in the initialize code block.
- 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.