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 Objects and Classes Variables and Methods Variables and Methods

In the initialize method of the Name class, set an instance variable called @title to the title argument.

when i type name.title it says that part 1 is no longer true

class.rb
class Name
  def first_name
    "Metal"
  end

  def initialize(title)
    @title = title
  end

  def last_name
    "Robot"
  end
end

name = name.new("mr.")
name.title

1 Answer

Jacob Herrington
Jacob Herrington
15,835 Points

Hi Francisco, you've made a really simple mistake. Don't worry though, even as a professional Ruby-on-Rails developer I do this all the time.

When you are referring to a class you usually start with an uppercase letter - the same way you did when you defined the class.

class Name   # here is where you are using an uppercase letter
...
end

When you initialize the new object from the class you should make sure to use that uppercase letter.

name = name.new("mr.")

Should be:

name = Name.new("mr.")