FIX: linking to house ads URLs shows not found error page

This commit is contained in:
Neil Lalonde 2019-05-07 14:32:32 -04:00
parent d9d7f4c8f4
commit cdc14398ba
3 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,10 @@ module ::AdPlugin
) )
end end
def show
render_json_dump(house_ad: HouseAd.find(params[:id])&.to_hash)
end
def create def create
ad = HouseAd.create(house_ad_params) ad = HouseAd.create(house_ad_params)
if ad.valid? if ad.valid?

View File

@ -2,7 +2,7 @@ export default {
resource: "admin.adminPlugins", resource: "admin.adminPlugins",
path: "/plugins", path: "/plugins",
map() { map() {
this.route("houseAds", { path: "/house-ads" }, function() { this.route("houseAds", { path: "/adplugin/house_ads" }, function() {
this.route("index", { path: "/" }); this.route("index", { path: "/" });
this.route("show", { path: "/:ad_id" }); this.route("show", { path: "/:ad_id" });
}); });

View File

@ -54,7 +54,7 @@ after_initialize do
AdPlugin::Engine.routes.draw do AdPlugin::Engine.routes.draw do
root to: 'house_ads#index' root to: 'house_ads#index'
resources :house_ads, only: [:index, :create, :update, :destroy] resources :house_ads, only: [:index, :show, :create, :update, :destroy]
resources :house_ad_settings, only: [:update] resources :house_ad_settings, only: [:update]
end end