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



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

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

#clerk_sign_in_pathObject



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

def 
  "#{Clerk.config.accounts_url}"
end

#clerk_sign_out_pathObject



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

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

#clerk_sign_up_pathObject



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

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

#current_accountObject



3
4
5
6
7
8
9
10
11
12
13
14
# 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
    nil
  end
end

#current_account_idObject



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

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