Class: Stay::BookingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/stay/bookings_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for, #current_store

Methods included from LocaleHelper

#all_locales_options, #available_locales, #available_locales_options, #config_locale?, #current_locale, #find_with_fallback_default_locale, #locale_full_name, #locale_param, #locale_presentation, #params_locale?, #should_render_locale_dropdown?, #supported_locale?, #supported_locales, #supported_locales_for_all_stores, #supported_locales_options, #user_locale?

Methods included from CurrencyHelper

#currency_options, #currency_presentation, #currency_symbol, #should_render_currency_dropdown?, #supported_currency_options

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/stay/bookings_controller.rb', line 8

def create
 @booking = current_user.bookings.new(check_in_date: params[:check_in_date], check_out_date: params[:check_out_date])
 
 @booking.add_rooms_and_calculate(params[:selected_rooms], params, @property)

 if @booking.save
   redirect_to new_property_booking_payment_path(property_id: @property.id, booking_id: @booking.id)
 else
   redirect_to property_path(@property)
 end
end

#newObject



4
5
6
# File 'app/controllers/stay/bookings_controller.rb', line 4

def new
 render layout: 'stay/application'
end