Class: Wco::SitesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Wco::SitesController
- Defined in:
- app/controllers/wco/sites_controller.rb
Instance Method Summary collapse
- #check_sitemap ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#check_sitemap ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/wco/sites_controller.rb', line 4 def check_sitemap @site = Wco::Site.find params[:id] :check_sitemap, @site out = @site.check_sitemap @results = out[:results] @total_count = out[:total_count] @error_count = out[:error_count] # redirect_to request.referrer end |
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/wco/sites_controller.rb', line 14 def create @site = Wco::Site.new params[:site].permit! :create, @site if @site.save flash_notice "created site" else flash_alert "Cannot create site: #{@site.errors.}" end redirect_to action: 'index' end |
#destroy ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/wco/sites_controller.rb', line 25 def destroy @site = Wco::Site.find params[:id] :destroy, @site if @site.destroy flash_notice 'ok' else flash_alert 'No luck.' end redirect_to action: 'index' end |
#edit ⇒ Object
36 37 38 39 |
# File 'app/controllers/wco/sites_controller.rb', line 36 def edit @site = Wco::Site.find params[:id] :edit, @site end |
#index ⇒ Object
41 42 43 44 |
# File 'app/controllers/wco/sites_controller.rb', line 41 def index :index, Wco::Site @sites = Wco::Site.all end |
#new ⇒ Object
46 47 48 49 |
# File 'app/controllers/wco/sites_controller.rb', line 46 def new :new, Wco::Site @new_site = Wco::Site.new end |
#show ⇒ Object
51 52 53 54 55 56 |
# File 'app/controllers/wco/sites_controller.rb', line 51 def show @site = Wco::Site.find params[:id] :show, @site @new_sitemap_path = Wco::SitemapPath.new( site_id: @site.id ) end |
#update ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/wco/sites_controller.rb', line 58 def update @site = Wco::Site.find params[:id] :update, @site if @site.update params[:site].permit! flash_notice "updated site" else flash_alert "Cannot update site: #{@site.errors.}" end redirect_to action: 'index' end |