Sha256: 5273086aa510f4747983dc333932e394f18b0fccb8aed11c7cc5478334af2678

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

class MembershipTypesController < ArtfullyOseController
  def index
    @membership_types = current_organization.membership_types.paginate(:page => params[:page], :per_page => 50)
  end

  def new
    with_type_selected do
      @membership_type = Kernel.const_get(params[:type].camelize).new
    end
  end

  def create
    @membership_type = MembershipType.new(params[:membership_type])
    @membership_type.organization = current_organization
    @membership_type.save
    redirect_to membership_types_path
  end

  def edit
    @membership_type = MembershipType.find(params[:id])
  end

  private
    def with_type_selected
      render :type and return if params[:type].blank?
      yield
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.8 app/controllers/membership_types_controller.rb
artfully_ose-1.2.0.pre.7 app/controllers/membership_types_controller.rb