Class: Wco::SitemapPathsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Wco::SitemapPathsController
- Defined in:
- app/controllers/wco/sitemap_paths_controller.rb
Instance Method Summary collapse
- #check ⇒ Object
- #clear ⇒ Object
- #create ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#check ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 6 def check @spath = Wco::SitemapPath.find params[:id] :check, @spath @spath.check end |
#clear ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 12 def clear @spath = Wco::SitemapPath.find params[:id] :clear, @spath @spath.update_attributes({ results: [] }) redirect_to request.referrer || sites_path(@spath.site) end |
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 19 def create :create, Wco::SitemapPath @spath = Wco::SitemapPath.new params[:spath].permit! if @spath.save flash_notice 'Success.' redirect_to wco.site_path(params[:spath][:site_id]) else flash_alert "Could not save spath: #{@spath.errors.}" render 'new' end end |
#edit ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 32 def edit @spath = Wco::SitemapPath.find params[:id] @site = @spath.site :edit, @spath end |
#new ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 38 def new @site = Wco::Site.find( params[:site_id] ) @spath = Wco::SitemapPath.new site: @site :new, @spath end |
#show ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 44 def show @spath = Wco::SitemapPath.find params[:id] @site = @spath.site :show, @spath render 'check' end |
#update ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/wco/sitemap_paths_controller.rb', line 52 def update @spath = Wco::SitemapPath.find params[:id] :update, @spath flag = @spath.update params[:spath].permit! if flag flash_notice 'Success' redirect_to site_path(@spath.site) else flash_alert 'No luck.' render action: 'edit' end end |