Module: Clerk::ApplicationHelper
- Defined in:
- app/helpers/clerk/application_helper.rb
Instance Method Summary collapse
- #clerk_add_card_path(account_id:, redirect_path:) ⇒ Object
- #clerk_sign_in_path ⇒ Object
- #clerk_sign_out_path ⇒ Object
- #clerk_sign_up_path ⇒ Object
- #current_account ⇒ Object
- #current_account_id ⇒ Object
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=#{account_id}&redirect_path=#{redirect_path}" end |
#clerk_sign_in_path ⇒ Object
36 37 38 |
# File 'app/helpers/clerk/application_helper.rb', line 36 def clerk_sign_in_path "#{Clerk.accounts_url}" end |
#clerk_sign_out_path ⇒ Object
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_path ⇒ Object
40 41 42 |
# File 'app/helpers/clerk/application_helper.rb', line 40 def clerk_sign_up_path "#{Clerk.accounts_url}/sign_up" end |
#current_account ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/clerk/application_helper.rb', line 3 def current_account 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: current_account_id) end rescue => e puts e nil end end |
#current_account_id ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/clerk/application_helper.rb', line 17 def current_account_id return @clerk_current_account_id if defined?(@clerk_current_account_id) @clerk_current_account_id ||= begin if Clerk.config.session_mode==:database_session current_account.id elsif Clerk.config.session_mode==:cookie_session = JSON.parse([:clerk_session]) nil if .nil? JSON.parse(["d"])["k"] end rescue => e nil end end |