Sha256: f0bb54b370827b2a4e55f09834bd217f4c47fc15b33ac0fa065dbfaa179f72d0

Contents?: true

Size: 824 Bytes

Versions: 11

Compression:

Stored size: 824 Bytes

Contents

class Store::StoreController < ActionController::Base
  layout "storefront"
  include CartFinder
  before_filter :store_organization

  def store_organization
    @store_organization ||= load_store_organization
  end

  #
  # Raises ActionController::RoutingError if a bad organization_slug is passed
  #
  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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
artfully_ose-1.3.0.pre3 app/controllers/store/store_controller.rb
artfully_ose-1.3.0.pre2 app/controllers/store/store_controller.rb
artfully_ose-1.3.0.pre1 app/controllers/store/store_controller.rb
artfully_ose-1.2.0 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.beta.1 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.alpha.2 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.alpha.1 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.pre.27 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.pre.26 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.pre.24 app/controllers/store/store_controller.rb
artfully_ose-1.2.0.pre.23 app/controllers/store/store_controller.rb