Learn Ruby - Final Project Issue


Hi All - this is my first time using the community forum for getting help. Hopefully I’m doing it right…

I (think) I have run into an issue with my final project, I am on Step 6 where we are asked to display All Tasks. I’ve got my code running well, but when I run the project from the command line the tasks that I have entered appear as memory locations, like so:

Justins-iMac:Desktop schilb_home$ ruby Todo.rb
You have created a new list.
You have added a task to the ToDo List!

Any thoughts on what I might be doing wrong? I tried to upload a txt file of my code but since I’m a new user it wouldn’t let me.


It looks like possibly a misreference of the object or method. Please post the URL of the project page, and you can post your code, just paste it in, select it all at once, and click the </> button in tool tray of the editor window.


I have the same problem! Here’s my code:

module Menu
	def menu
		" Welcome to your to do list! 
		This menu will help you use the task list system
		1) Add
		2) Show
		Q) Quit "

	def show

module Promptable
	def prompt(message = 'What would you like to do?', symbol = ':> ')
		print message
		print symbol


class List 

	attr_reader :all_tasks

	def initialize(all_tasks)
		@all_tasks = [ ]

	def add(task)
		all_tasks << task

	def show


class Task
	attr_reader :description
	def initialize(description)
		@description = description


  if __FILE__ == $PROGRAM_NAME    
          include Menu
          include Promptable
          my_list = List.new(my_list)
          puts 'Please choose from the following list:' 
          	until ['q'].include?(user_input = prompt(show).downcase)
          		case user_input
					when "1"
						my_list.add(Task.new(prompt('What is the task you would like to accomplish?')))
					when "2"
						puts my_list.show
						puts "Sorry, I did not understand"
          puts 'Outro - Thanks for using the menu system!'


I just recently started the Ruby course and have the same problem. I noticed if I remove the reference for creating a Task object the program runs. So instead of ```
my_list.add(Task.new(‘Make Breakfast’))

If I used
**my_list.add('Make Breakfast')**
the code runs with no issue and passes the suggested ```
**if my_list.show.join.include?('#<')**

I am pretty sure this is not the solution but I am not sure why including the
my_list.add(Task.new(‘Make Breakfast’))
returns #Task:... results instead of just the listed tasks.


I had exactly the same question, and cedric_millshotmail’s solution (creating a task using the method rather than initializing a new instance of Task class) worked for me.

Anyone know why the following only returns object ID
**if my_list.show.join.include?('#&lt;')**