Hei guys i working on rest api on ruby on rails i tried to make simple my route using group it by what module is
so i go like this
namespace :backend do
namespace :merchant do
resources :merchants
end
resources :owners
and my controller was like this
class Backend::Merchant::MerchantsController < ApplicationController
def index
# http://localhost:3000/backend/merchants
# on post request get all merchant
allMerchant = Merchant.all
render json: allMerchant
end
end
and i got error like
uninitialized constant Backend::Merchant::MerchantsController::Merchant
it because my model class not regonize by controller on this part
allMerchant = Merchant.all
my code struktur is like
controller
|
---- backend
|
---- merchant
|
---- merchant_controller.rb
model
|
---- merchant.rb
i realy appreciate any suppor for you all
NB i using mongoid