Created
January 5, 2017 17:15
-
-
Save phensalves/dc1ab0d80222921698324b032eb18961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
load_deals unless mobile_device? || request.format == :js | |
@deal_weekday = DealWeekday.by_weekday(Weekday.from_slug(params[:weekday])).by_slug(params[:slug]).active.first | |
if !@deal_weekday || !@deal_weekday.active | |
flash[:error] = '<strong>Desculpe!</strong> Não encontramos a pedida que você solicitou.' | |
redirect_to home_path(@city.slug) | |
return false | |
end | |
@deal = @deal_weekday.deal | |
@taken_count = @deal_weekday.vouchers_taken_count | |
#@available_count = @deal_weekday.vouchers_limit_count - @deal_weekday.vouchers_taken_count | |
@available_count = @deal_weekday.available_cache - @deal_weekday.vouchers_taken_count | |
render 'deals/show' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment