module CardController::Aliasing
overrides REST methods to handle alias redirects and card reloads
Public Instance Methods
read()
click to toggle source
Calls superclass method
# File lib/card_controller/aliasing.rb, line 4 def read return super unless redirect_to_aliased? hard_redirect target_url end
Private Instance Methods
redirect_to_aliased?()
click to toggle source
aliased names are not redirected when a view is specified for a simple alias card
# File lib/card_controller/aliasing.rb, line 29 def redirect_to_aliased? return false unless card&.alias? card.compound? || params[:view].blank? end
target_url()
click to toggle source
url to which aliased requests should be redirected
# File lib/card_controller/aliasing.rb, line 22 def target_url target_params = params.clone.merge(mark: card.target_name).to_unsafe_h target_params.delete :controller card.target_card.format(:base).path target_params end