Sha256: 4aa5f7be6edb74c92888bc99097d8420fabd4726ec03215fe920ac92f99bc0c0

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

require_dependency "phcmemberspro/application_controller"

module Phcmemberspro
	class Members::MainsController < ApplicationController

		# Security & Action Filters
		before_action :require_user
		layout :phcmemberspro_membersmain_layouts_resolver
		before_action :set_members_main, only: [:show, :edit, :update, :destroy]

		# Member Profile List
		def index
			@members_mains = Members::Main.all
		end

		# Detailed Member Profile
		def show
		end

		# New Member Profile
		def new
			@members_main = Members::Main.new
		end

		# Edit Member Profile
		def edit
		end

		# Create Member Profile Action
		def create
			@members_main = Members::Main.new(members_main_params)
			@members_main.user_id = current_user.id
			if @members_main.save
				redirect_to members_mains_path, notice: 'Member profile has been successfully created.'
				else
					render :new
			end
		end

		# Update Member Profile Action
		def update
			if @members_main.update(members_main_params)
				redirect_to members_mains_path, notice: 'Member profile has been successfully updated.'
				else
					render :edit
			end
		end

		# Delete Member Profile Action
		def destroy
			@members_main.destroy
			redirect_to members_mains_path, notice: 'Member profile and all businesses was successfully destroyed.'
		end

		private

		# Grab User Session Key (For ID)
		def current_user
			@_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
		end

		# Common Callbacks
		def set_members_main
			@members_main = Members::Main.find(params[:id])
		end

		# White List
		def members_main_params
			params.require(:members_main).permit(:mfirstname, :mlastname, :mtitle, :memail, :mphone, :mnotes, :smfacebook, :smtwitter, :smlinkedin, :user_id)
		end

	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcmemberspro-5.3.8 app/controllers/phcmemberspro/members/mains_controller.rb
phcmemberspro-5.3.7 app/controllers/phcmemberspro/members/mains_controller.rb
phcmemberspro-5.3.6 app/controllers/phcmemberspro/members/mains_controller.rb