class Store::StoreController < ActionController::Base layout "storefront" include CartFinder before_filter :store_organization def store_organization @store_organization ||= load_store_organization end def load_store_organization if params[:organization_slug].present? Organization.find_using_slug(params[:organization_slug]) 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 end