title: Can't understand why I'm getting a `initialize': uninitialized constant Controller::View (NameError)
body: <p>I'm trying to understand why I'm getting this error and I suspect it's because I have my Controller class and View class in two separate Ruby files. I was told that using require_relative 'filename' should reference all the code from one file into another, but I seem to be missing something. Okay here goes,</p>
  
  <p>In <strong>controller.rb</strong> file, I have</p>
  
  <pre><code>require_relative 'view'
  require_relative 'deck_model'
  require_relative 'flashcard_model'
  
  
  
  class Controller
  
    def initialize
      @deckofcards = Deck.new
      @welcome = View.new.welcome
      @player_guess = View.new.get_user_guess
      @success_view = View.new.success
      @failure_view = View.new.failure
    end
  
    def run
      #Logic to run the game
      # @current_card
      # @user_guess
      puts "Let's see if this prints"
      # pull_card_from_deck
  
    end
  
  end
  </code></pre>
  
  <p>In my <strong>view.rb</strong> file, I have,</p>
  
  <pre><code>require_relative 'controller'
  
  class View
  
      attr_accessor :userguess
  
      def initialize (userguess = " ")
          @userguess = userguess
      end
  
      def welcome
          system ("clear")
          puts "Welcome! Let's play a game."
          puts "I'll give you a definition and you have to give me the term"
          puts "Ready..."
      end
  
      def get_user_guess
          @userguess = gets.chomp.downcase
      end
  
      def success
          puts "Excellent! You got it."
      end
  
      def failure
          puts "No, that's not quite right."      
      end
  
  
  end
  </code></pre>
  
  <p>However when I run <strong>controller.rb</strong>, I get the following error,</p>
  
  <pre><code>/Users/sean/Projects/flash/source/controller.rb:11:in `initialize': uninitialized constant Controller::View (NameError)
  from /Users/sean/Projects/flash/source/controller.rb:51:in `new'
  from /Users/sean/Projects/flash/source/controller.rb:51:in `&lt;top (required)&gt;'
  from /Users/sean/Projects/flash/source/view.rb:1:in `require_relative'
  from /Users/sean/Projects/flash/source/view.rb:1:in `&lt;top (required)&gt;'
  from controller.rb:1:in `require_relative'
  from controller.rb:1:in `&lt;main&gt;'
  </code></pre>
  
  <p>Can anyone please help me figure this out. </p>