lundi 24 août 2015

Ruby on Rails. Engine. Uninitialized constant error on production

I have a rails 3 app that is working locally, I am using a rails engine for a module within my app. When I deploy to the production server I get 404 not found errors to my endpoints, more specifically this error:

ActionController::RoutingError (uninitialized constant Api::V2::QuestionnaireController):

However locally I don't get this error and I have access to this controller and all it's actions. My routes in the main app where I am making the calls is

namespace :api, defaults: {format: "json"} do
 namespace :v2 do
  resources :questionnaires

Inside my Engine I have inside models/qtn/questionnaire.rb

class Qtn::Questionnaire < ActiveRecord::Base end

and in my controller controllers/questionnaire_controller.rb

class QuestionnairesController < ApplicationController

def index @questionnaires = Qtn::Questionnaire.all

respond_to do |format|
  format.html # index.html.erb
  format.json { render json: @questionnaires }
end

end

end

Could anyone help explain why this works perfectly on localhost but I can not access these endpoints once in production?

1 commentaire: