Skip to content

Instantly share code, notes, and snippets.

@beck03076
Last active December 14, 2015 18:14
Show Gist options
  • Save beck03076/041a0fb70fb794185183 to your computer and use it in GitHub Desktop.
Save beck03076/041a0fb70fb794185183 to your computer and use it in GitHub Desktop.
def process_available_days(p)
[0,1,0,1,0,1,0]
end
def prepare_params(p)
p[:available_days] = process_available_days(p[:available_days])
p.except(:branches_deals)
end
def create
deals_parameters = prepare_params(deal_params)
@deal = Deal.new(deals_parameters)
if @deal.save
render json: @deal, status: :created, location: @deal
else
render json: @deal.errors, status: :unprocessable_entity
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment