Class: ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ApplicationController
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.
Direct Known Subclasses
AbilitiesController, AdminController, AdvertisementController, AnswersController, CategoriesController, CloseReasonsController, CommentsController, DonationsController, EmailLogsController, ErrorsController, FakeCommunityController, FlagsController, LicensesController, MicroAuth::AppsController, MicroAuth::AuthenticationController, ModWarningController, ModeratorController, NotificationsController, PinnedLinksController, PostHistoryController, PostTypesController, PostsController, QuestionsController, ReactionsController, ReportsController, SearchController, SiteSettingsController, SubscriptionsController, SuggestedEditController, TagSetsController, TagsController, TasksController, TourController, TwoFactorController, UsersController, VotesController
Instance Method Summary
collapse
Instance Method Details
#dashboard ⇒ Object
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
|
42
|
# File 'app/controllers/application_controller.rb', line 42
def keyboard_tools; end
|
#upload ⇒ Object
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
|