Class: WebsitesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WebsitesController
- Defined in:
- app/controllers/websites_controller.rb
Instance Attribute Summary
Attributes inherited from ApplicationController
#current_user, #current_user Used for unit testing, this is normally managed by Devise
Instance Method Summary collapse
- #check_count ⇒ Object
-
#create ⇒ Object
POST /websites.
-
#destroy ⇒ Object
DELETE /websites/1.
-
#edit ⇒ Object
GET /websites/1/edit.
- #index ⇒ Object
-
#new ⇒ Object
GET /websites/new.
- #show ⇒ Object
-
#update ⇒ Object
PATCH/PUT /websites/1.
Methods inherited from ApplicationController
#clear_search_index, #search_params
Instance Method Details
#check_count ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/websites_controller.rb', line 22 def check_count @our_count = @website.images.count @their_count = 0 uniqs = @website.strategy_check_count @their_count = uniqs.count our_c_ids = @website.images.collect{|i| i.canonical_id} @our_count = @website.images.count @our_matched_ids = uniqs & our_c_ids @our_unmatched_ids = our_c_ids - uniqs @their_unmatched_ids = uniqs - our_c_ids end |
#create ⇒ Object
POST /websites
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/websites_controller.rb', line 47 def create @website = Website.new(website_params) if @website.save if request.format.html? redirect_to @website, notice: 'Website was successfully created.' else render :json => @website.to_json end else if request.format.html? render :new else render :json => { :errors => @website.errors. } end end end |
#destroy ⇒ Object
DELETE /websites/1
83 84 85 86 |
# File 'app/controllers/websites_controller.rb', line 83 def destroy @website.destroy redirect_to websites_url, notice: 'Website was successfully destroyed.' end |
#edit ⇒ Object
GET /websites/1/edit
43 44 |
# File 'app/controllers/websites_controller.rb', line 43 def edit end |
#index ⇒ Object
13 14 15 |
# File 'app/controllers/websites_controller.rb', line 13 def index @websites = Website.all end |
#new ⇒ Object
GET /websites/new
38 39 40 |
# File 'app/controllers/websites_controller.rb', line 38 def new @website = Website.new end |
#show ⇒ Object
19 20 |
# File 'app/controllers/websites_controller.rb', line 19 def show end |
#update ⇒ Object
PATCH/PUT /websites/1
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/controllers/websites_controller.rb', line 66 def update if @website.update(website_params) if request.format.html? redirect_to @website, notice: 'Website was successfully updated.' else render @website end else if request.format.html? render :edit else render :json => { :errors => @website.errors. } end end end |