ruby on rails - Handle show action if no record -


That's why I have to I'm using a CMS and a root domain I it works perfectly if a campaign or CMS page picks it up, but if I get a template, if I mistake error (as I show the campaign a redirect donation process). Anyway the error is missing to fix this template? If I defend within the controller so it does not kill the CMS and if I have CMS route before it will hit 404 before hitting the drive controller.

Controller

  Class Campaign Controller & lt; ApplicationController before_action: find_campaign def Show End Protected Def find_campaign Campaign = Campaign. Friendly.find (params [: id]) redirect_to donate_index_path (campaign_id: (campaign.id if campaign.active?)), Method :: Defend end end  

routes.rb

  Cwi :: application.routes.draw # ... Resources: campaign, only :: show, path: '/' Comfy_route: cms_admin ,: path = & gt; '/ Admin' root: to = & gt; "CMS / Content # Show" comfy_route: cm ,: path = & gt; '/' ,: Sitemap = & gt; False end  


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -