Module: Clerk::ApplicationHelper

Defined in:
app/helpers/clerk/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#clerk_add_card_path(account_id:, redirect_path:) ⇒ Object



44
45
46
# File 'app/helpers/clerk/application_helper.rb', line 44

def clerk_add_card_path(account_id:, redirect_path:)
  "#{Clerk.accounts_url}/add_card?account_id=#{}&redirect_path=#{redirect_path}"
end

#clerk_sign_in_pathObject



36
37
38
# File 'app/helpers/clerk/application_helper.rb', line 36

def 
  "#{Clerk.accounts_url}"
end

#clerk_sign_out_pathObject



32
33
34
# File 'app/helpers/clerk/application_helper.rb', line 32

def clerk_sign_out_path
  "#{Clerk.accounts_url}/sign_out"
end

#clerk_sign_up_pathObject



40
41
42
# File 'app/helpers/clerk/application_helper.rb', line 40

def 
  "#{Clerk.accounts_url}/sign_up"
end

#current_accountObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/clerk/application_helper.rb', line 3

def 
  return @clerk_current_account if defined?(@clerk_current_account)
  @clerk_current_account ||= begin
    if Clerk.config.session_mode==:database_session
      raise "TODO"
    elsif Clerk.config.session_mode==:cookie_session
      Clerk::Account.find_by(id: )
    end
  rescue => e
    puts e
    nil
  end
end

#current_account_idObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/clerk/application_helper.rb', line 17

def 
  return @clerk_current_account_id if defined?(@clerk_current_account_id)
  @clerk_current_account_id ||= begin
    if Clerk.config.session_mode==:database_session
      .id
    elsif Clerk.config.session_mode==:cookie_session
      session_cookie = JSON.parse(cookies[:clerk_session])
      nil if session_cookie.nil?
      JSON.parse(session_cookie["d"])["k"]
    end
  rescue => e
    nil
  end
end