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 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.")