My custom route generates 404


(OG) #1

Hello,
I’m trying to get new site section working…

I’ve got .json part succesfully serving data (http://localhost/faq_categories.json)

But for HTML request (http://localhost/faq_categories) Discourse generates 404 not found “Oops! That page doesn’t exist or is private”. I do have proper erb.html file in place.

I think that routing is working correctly (otherwise there would be error). Is there any part of Discourse application that would prevent me to run this simple code correctly?

Can you please help me to find what am I missing? Thanks a lot…!

/discourse/config/routes.rb

get “/faq_categories” => “faq_categories#index”

/discourse/app/controllers/faq_categories_controller.rb

class FaqCategoriesController < ApplicationController
def index
@faq_categories = FaqCategory.all

respond_to do |format|
  format.html do
    render :index
  end
  format.json do
    render_serialized(@faq_categories, FaqCategorySerializer)
  end
end

end
end

discourse/app/views/faq_categories/index.html.erb

`

Frequently Asked Questions

`

(Rafael dos Santos Silva) #2

You need to wire the front-end part. Ember router needs to know about this route too.


(OG) #3

Thanks for reply! I though that when no error from ember.js is raised then its ok… Which files are essentially needed to start with (so I can debug step by step)?


(OG) #4

ahh… I’ve just found /discourse/app/assets/javascripts/discourse/routes/app-route-map.js.es6

Now it generates only header… I will look at it…