title: Rails: uninitialized constant class name
body: <p>I'm getting this problem:</p>
  
  <blockquote>
    <p>uninitialized constant QuestionsController::Question</p>
  </blockquote>
  
  <pre><code>def index
      @Question
      @preguntas = Question.all
      @project_id = request.original_url.split('.').last
      set_current_project(@project_id)
      if(@project_id.include? "http")
  </code></pre>
  
  <p>On my <code>QuestionController</code> randomly after changing nothing from my application, any idea what may be causing it? here's the complete <code>.rb</code> file:</p>
  
  <pre><code>class QuestionsController &lt; ApplicationController
  before_action :require_user
  before_action :require_project
  before_action :require_user, except: [:new, :create]
  before_action :current_project, only: [:index]
  def index
      @preguntas = Question.all
      @project_id = request.original_url.split('.').last
      set_current_project(@project_id)
  if(@project_id.include? "http")
  @project_id = "0"
  end
      if(@project_id != "0")
          @proyecto = Project.find(@project_id)
      end 
  end
  
  def show
    @pregunta = Question.find(params[:id])
  end
  
  def new
    @pregunta = Question.new
  end
  
  def create
    @pregunta = Question.new(pregunta_params)
    if @pregunta.save
       redirect_to @pregunta
    else
       render 'new'
    end
  end
   def edit
       @pregunta = Question.find(params[:id])
  end 
  
  def update
    @pregunta = Question.find(params[:id])
    if @pregunta.update(pregunta_params)
      redirect_to @pregunta
    else
      render 'edit'
    end
  end
  
  
   def destroy
      @pregunta = Question.find(params[:id])
      @pregunta.destroy
      flash[:danger] = "Se ha borrado la pregunta"
      redirect_to questions_path
  end 
  
  
  def require_same_user 
      set_project
      if current_user != @project.user &amp;&amp; !@current_user.admin?
          flash[:danger] = "Solo puedes editar tus artículos"
          redirect_to root_path
      end 
  end 
  
  def require_project
      if current_user.projects.count &lt;1 &amp;&amp; !current_user.admin?
          redirect_to root_path
      end 
  end 
  
  private
      def pregunta_params
          params.require(:question).permit(:question, :value, :phase, :area, :input)
      end
  </code></pre>
  
  <p>end</p>