Class: V2Users::BaseController
Direct Known Subclasses
ReservationGuestUpdatesController, AddOnPackagesController, V2Users::Bloggers::ReviewsController, BloggersController, BookingsController, PagesController, RestaurantPackagesController, RestaurantsController, Reviews::PhotosController, ReviewsController, UsersController
Class Method Summary
collapse
Instance Method Summary
collapse
#append_info_to_payload
#setup_locale
#my_response_cache
#dynamic_pricings_formatter, #link_to_admin_reservations_path_by_id, #link_to_admin_restaurants_path_by_id, #link_to_log, #optional_locales, #optional_locales_with_labels, #staff_signed_in?
Class Method Details
.default_url_options(options = {}) ⇒ Object
81
82
83
|
# File 'app/controllers/v2_users/base_controller.rb', line 81
def self.default_url_options(options = {})
(I18n.locale.to_sym.eql?(I18n.default_locale.to_sym) ? {} : { locale: I18n.locale }).merge options
end
|
Instance Method Details
#activate_cache?(cache_key, options = {}) ⇒ Boolean
TODO: rename to `by_pass_cache?` use __cache=false to by pass cache
87
88
89
90
91
92
93
94
95
|
# File 'app/controllers/v2_users/base_controller.rb', line 87
def activate_cache?(cache_key, options = {})
return true if params[:__cache] == 'false'
if cache_key.is_a?(Hash) && cache_key[:etag].present?
options = cache_key.dup
cache_key = options.delete(:etag)
end
stale?(cache_key, options)
end
|
#current_user_ck ⇒ Object
97
98
99
|
# File 'app/controllers/v2_users/base_controller.rb', line 97
def current_user_ck
user_signed_in? ? current_user.cache_key : ''
end
|
#identity_cache_memoization(&block) ⇒ Object
22
23
24
|
# File 'app/controllers/v2_users/base_controller.rb', line 22
def identity_cache_memoization(&block)
IdentityCache.cache.with_memoization(&block)
end
|
#set_csrf_token ⇒ Object
28
29
30
31
32
33
34
|
# File 'app/controllers/v2_users/base_controller.rb', line 28
def set_csrf_token
cookies[:csrftoken] = {
value: form_authenticity_token,
expires: 1.day.from_now
}
end
|