Sha256: fedceaaeb75f2c49d13e4a32ac07423c5139e10f34467dadb07060987af926b3

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

class MembershipsController < ArtfullyOseController
  before_filter :load_tags, :only => [:index]

  def index
    @person = Person.find(params[:person_id])
    @membership_types = current_organization.membership_types
  end

  def bulk_update
    @person = Person.find(params[:person_id])
    extend_memberships(params)
    redirect_to person_memberships_path(@person)
  end

  private

    def extend_memberships(params)
      
      #I hate how these are tied to the button text
      if params[:commit].eql? "Extend Memberships"
        params[:membership_ids].each do |membership_id|
          Membership.find(membership_id).adjust_expiration_to(params[:ends_at])
        end
        flash[:notice] = "Memberships have been adjusted."
      end
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.8 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.pre.7 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.pre.6 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.pre.5 app/controllers/memberships_controller.rb