A night at the movies | 7. Update | Ruby


#1

.downcase isn't being detected.

movies = {
   Godfather: 10, 
   The_Big_Short: 5,
   Too_big_to_fail: 8
}
puts "Select an option: (add, update, display or delete)".downcase

choice = gets.chomp.downcase
case choice
    when 'add'
        puts "Select a movie title"
        title = gets.chomp
    if movies[title.to_sym].nil?
        puts "Rate this movie:(1-10)"
        rating = gets.chomp
          movies[title.to_sym] = rating.to_i
        puts "#{title} has been added with a rating of #{rating}"
      else
        puts "#{title} already exists!"
          end 
    when 'update' 
        puts "What movie would you want to update?"
        title = gets.chomp
        if movies[title.to_sym].nil?
            puts "Please select an existing movie from the list"
        else
        puts "Movie updated! Please rate #{title}, (0-10)"
            rating = gets.chomp
            movies[title.to_sym] = rating.to_i
        puts "#{title} has been updated with a rating of #{rating}."
          end
    when 'display'
        puts 'Movies!'
    when 'delete'
        puts 'Deleted!'
else
        puts 'Error!'
    end

When I select an option, then 'update' and when 'godfather'(lowercased) is inputted, it renders as: "Please select an existing movie from the list"
But once 'Godfather' is capitalized, it is detected and therefore 'updated'. So how can I have it that whatever title is inputted, (of course already included in the hash) will be detected whether capitalized or not?

I'm sure the mistake is quite simple. Just can't find it....Thanks for all the help!


#3