Sha256: b3217d52f606b49d110032f77ab5b5794fe342b99ad6727d9ea8c0388b49f179

Contents?: true

Size: 1.15 KB

Versions: 51

Compression:

Stored size: 1.15 KB

Contents

require_dependency "think_feel_do_engine/application_controller"

module ThinkFeelDoEngine
  module Coach
    # Manage Participant Activities.
    class MembershipsController < ApplicationController
      before_action :authenticate_user!
      before_action :set_membership, :set_group

      def update
        authorize! :update, @membership
        if @membership.update(membership_params)
          redirect_to coach_group_patient_dashboards_path(@group),
                      notice: "Participant was successfully stepped."
        else
          redirect_to coach_group_patient_dashboards_path(@group),
                      alert: @membership.errors.full_messages.join(", ") +
                        "End date cannot be set prior to tomorrow's date. "\
                        "Please use [Discontinue] or [Terminate Access]."
        end
      end

      private

      def membership_params
        params
          .require(:membership)
          .permit(:stepped_on)
      end

      def set_group
        @group = Group.find(params[:group_id])
      end

      def set_membership
        @membership = Membership.find(params[:id])
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
think_feel_do_engine-3.19.9 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.8 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.7 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.6 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.5 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.4 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.3 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.2 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.1 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.19.0 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.18.0 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.17.2 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.17.1 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.17.0 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.16.3 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.16.2 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.16.1 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.15.7 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.16.0 app/controllers/think_feel_do_engine/coach/memberships_controller.rb
think_feel_do_engine-3.15.6 app/controllers/think_feel_do_engine/coach/memberships_controller.rb