Skip to content

Instantly share code, notes, and snippets.

@kenton
Created September 7, 2012 15:17
Show Gist options
  • Save kenton/3667077 to your computer and use it in GitHub Desktop.
Save kenton/3667077 to your computer and use it in GitHub Desktop.
if self.respond_to?(:current_user) && current_user.present?
is_operator_facing = current_user.is_operator?
elsif local_assigns[:is_operator_facing]
is_operator_facing = local_assigns[:is_operator_facing]
else
is_operator_facing = false
end
#### ... some other unrelated code ####
if is_operator_facing
rp = rr.ride_pricing.reprice_without_promo_code
end
## within vehicle_side_bar partial
if current_user
is_operator_facing = current_user.is_operator?
elsif local_assigns[:is_operator_facing]
is_operator_facing = local_assigns[:is_operator_facing]
else
is_operator_facing = false
end
# then including :locals => {:current_user => current_user}
## original code:
if current_user && current_user.is_operator?
rp = rr.ride_pricing.reprice_without_promo_code
end
# updated_code
if is_operator_facing
rp = rr.ride_pricing.reprice_without_promo_code
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment