Class: Course::ConditionsController

Inherits:
ComponentController show all
Defined in:
app/controllers/course/conditions_controller.rb

Instance Method Summary collapse

Methods included from ApplicationSignInCallbacksConcern

#sign_in

Methods included from ApplicationPaginationConcern

#page_param

Methods included from ApplicationAnnouncementsConcern

#global_announcements, #unread_global_announcements

Methods included from ApplicationInstanceUserConcern

#current_instance_user

Methods included from ApplicationUserTimeZoneConcern

#set_time_zone

Methods included from ApplicationUserConcern

#handle_access_denied, #publicly_accessible?

Methods included from ApplicationComponentsConcern

#handle_component_not_found

Instance Method Details

#authorize_conditionalObject


26
27
28
# File 'app/controllers/course/conditions_controller.rb', line 26

def authorize_conditional
  authorize! :read, @conditional
end

#load_and_authorize_conditionalObject


30
31
32
33
# File 'app/controllers/course/conditions_controller.rb', line 30

def load_and_authorize_conditional
  set_conditional
  authorize_conditional
end

#return_to_pathString, Symbol

Returns:

  • (String)

    The path to return to when successfully executing or failing an action, or when the user clicks on the Back button.

  • (Symbol)

    Similar to above.

Raises:

  • (NotImplementedError)

9
10
11
12
# File 'app/controllers/course/conditions_controller.rb', line 9

def return_to_path
  raise NotImplementedError, 'To be implemented by the condition controllers of a specific'\
    'conditional.'
end

#set_conditionalObject

Set the instance variable @conditional that possesses the condition. The conditional id should be retrieved from the path.

For example, the path of some condition controller for an achievement (the conditional) is courses/1/achievements/1/condition///` To retrieve and set the conditional, @conditional = Course::Achievement.find(params[:achievement_id])

Raises:

  • (NotImplementedError)

21
22
23
24
# File 'app/controllers/course/conditions_controller.rb', line 21

def set_conditional
  raise NotImplementedError, 'To be implemented by the condition controllers of a specific'\
    'conditional.'
end