Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/application_controller.rb

Overview

Application controller. This is the overarching control center for the application, which every web controller inherits from. Any application-wide code-based configuration is done here, as well as providing controller helper methods and global callbacks.

Instance Method Summary collapse

Instance Method Details

#dashboardObject



34
35
36
37
38
39
40
# File 'app/controllers/application_controller.rb', line 34

def dashboard
  @communities = Community.all
  @edits = Post.unscoped do
    SuggestedEdit.unscoped.joins(:post).where(active: true).group(Arel.sql('posts.category_id')).count
  end
  render layout: 'without_sidebar'
end

#keyboard_toolsObject



42
# File 'app/controllers/application_controller.rb', line 42

def keyboard_tools; end

#uploadObject



24
25
26
27
28
29
30
31
32
# File 'app/controllers/application_controller.rb', line 24

def upload
  if ActiveStorage::Blob.service.class.name.end_with?('S3Service')
    redirect_to helpers.upload_remote_url(params[:key]), status: 301, allow_other_host: true
  else
    blob = params[:key]
    redirect_to url_for(ActiveStorage::Blob.find_by(key: blob.is_a?(String) ? blob : blob.key)),
                allow_other_host: true
  end
end