title: RoR: NameError: Uninitialized constant (Service)
body: <p>This is my first question at
  I'm quite new to RoR and I try to understand the PINGOWebApp, which you can find here <a href="https://github.com/PingoUPB/PINGOWebApp" rel="nofollow noreferrer">https://github.com/PingoUPB/PINGOWebApp</a>.
  They specified their &quot;question&quot; model <strong>(app/models/question.rb)</strong> in different types of questions in <strong>app/services/ (e.g. number_question.rb, text_question.rb)</strong>, all inheriting from <strong>app/services/generic_question.rb:</strong></p>
  <pre><code>class GenericQuestion &lt; Delegator
    
    def initialize(question)
      super
      @question = question
    end
    
    def __getobj__ # required
      @question
    end
    
    def __setobj__(obj)
        @question = obj # change delegation object
    end
    
    def to_model
      @question.to_model
    end
  
    def has_settings?
      false
    end
  
    def add_setting(key, value)
      @question.settings ||= {}
      @question.settings[key.to_s] = value.to_s
    end
    
    def self.model_name
      Question.model_name
    end
    
    def self.reflect_on_association arg
      Question.reflect_on_association arg
    end
    
    alias_method :question, :__getobj__ # reader for survey
    
  end
  </code></pre>
  <p>Here comes my first questions:</p>
  <ol>
  <li><p>Since there's no service generator, they must have created all the ruby-files in app/service/ by hand, haven't they? Or what other ways are there?</p>
  </li>
  <li><p>I forked the project and added another service by hand, called dragdrop_question.rb, and integrated it into the question_controller.rb:</p>
  <p>class QuestionsController &lt; ApplicationController
  def new
  @question_single = SingleChoiceQuestion.new.tap { |q| q.question_options.build }
  @question_multi = MultipleChoiceQuestion.new.tap { |q| q.question_options.build }
  @question_text = TextQuestion.new
  @question_number = NumberQuestion.new  #refactor this maybe?
  @question_dragdrop = DragDropQuestion.new.tap { |q| q.answer_pairs.build }
  end
  end</p>
  </li>
  </ol>
  <p>I also adapted the view and tested it locally. I got NameError at /questions/new
  uninitialized constant QuestionsController::DragDropQuestion. <br />
  If I add</p>
  <pre><code>require_dependency &quot;app/services/dragdrop_question.rb&quot;
  </code></pre>
  <p>to the question_controller.rb the error is gone, but they haven't done it anything like that. So how do they introduce the services to controllers?<br />
  <br />
  Thanks for any help in advance, especially for tutorials or book references what explain the controller-model-view-service schema.</p>