Module: ShopQiApp::ApplicationHelper

Included in:
ApplicationController
Defined in:
app/helpers/shopqi_app/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_shop!Object

必须通过认证



3
4
5
# File 'app/helpers/shopqi_app/application_helper.rb', line 3

def authenticate_shop! # 必须通过认证
  redirect_to main_app.root_path unless signed_in?
end

#current_shopObject



11
12
13
# File 'app/helpers/shopqi_app/application_helper.rb', line 11

def current_shop
  @current_shop ||= (cookies.signed[:shop_id] && Shop.find_by_id(cookies.signed[:shop_id]))
end

#shop_urlObject



15
16
17
# File 'app/helpers/shopqi_app/application_helper.rb', line 15

def shop_url
  "http://#{current_shop.shopqi_domain}"
end

#signed_in?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/helpers/shopqi_app/application_helper.rb', line 7

def signed_in?
  !current_shop.nil?
end