Class: Course::Video::TopicsController
- Inherits:
-
Controller
- Object
- ActionController::Base
- ApplicationController
- Controller
- ComponentController
- Controller
- Course::Video::TopicsController
- Includes:
- Discussion::PostsConcern
- Defined in:
- app/controllers/course/video/topics_controller.rb
Instance Method Summary collapse
Methods included from Discussion::PostsConcern
#skip_update_topic_status, #update_topic_pending_status
Methods included from ApplicationSignInCallbacksConcern
Methods included from ApplicationPaginationConcern
Methods included from ApplicationAnnouncementsConcern
#global_announcements, #unread_global_announcements
Methods included from ApplicationInstanceUserConcern
Methods included from ApplicationUserTimeZoneConcern
Methods included from ApplicationUserConcern
#handle_access_denied, #publicly_accessible?
Methods included from ApplicationComponentsConcern
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/course/video/topics_controller.rb', line 14 def create result = @topic.class.transaction do raise ActiveRecord::Rollback unless @post.save && create_topic_subscription && update_topic_pending_status raise ActiveRecord::Rollback unless @topic.save true end head :bad_request unless result end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/course/video/topics_controller.rb', line 8 def index @topics = @video.topics.includes(posts: :children).order(:timestamp) @topics = @topics.reject { |topic| topic.posts.empty? } @posts = @topics.map(&:posts).inject(Course::Discussion::Post.none, :+) end |
#show ⇒ Object
24 25 |
# File 'app/controllers/course/video/topics_controller.rb', line 24 def show end |