Class: Store::StoreController

Inherits:
ActionController::Base
  • Object
show all
Includes:
CartFinder
Defined in:
app/controllers/store/store_controller.rb

Instance Method Summary collapse

Methods included from CartFinder

#cart_name, #create_new_cart, #current_box_office_cart, #current_cart, #current_cart=, #current_sales_console_cart, #session_cart, #session_key

Instance Method Details

#load_store_organizationObject

Raises ActionController::RoutingError if a bad organization_slug is passed



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/store/store_controller.rb', line 13

def load_store_organization
  if params[:organization_slug].present?
    org = Organization.find_using_slug(params[:organization_slug])
    raise ActionController::RoutingError.new("Not Found") if org.nil?
    org
  elsif params[:controller].end_with? "events"
    Event.find(params[:id]).organization
  elsif params[:controller].end_with? "shows"
    Show.where(:uuid => params[:id]).first.organization
  elsif current_member
    current_member.organization
  else
    nil
  end 
end

#store_organizationObject



6
7
8
# File 'app/controllers/store/store_controller.rb', line 6

def store_organization
  @store_organization ||= load_store_organization
end