Skip to content

Instantly share code, notes, and snippets.

@KamaKAzii
Created June 29, 2010 06:52
Show Gist options
  • Save KamaKAzii/456889 to your computer and use it in GitHub Desktop.
Save KamaKAzii/456889 to your computer and use it in GitHub Desktop.
class BookingsController < ApplicationController
def index
@bookings = Booking.all
@booking = Booking.all(:condition => Date.today <= bookingdate < Date.today + 7)
end
def show
@booking = Booking.find(params[:id])
end
def new
@booking = Booking.new
end
def create
@booking = Booking.new(params[:booking])
if @booking.save
flash[:notice] = 'Booking was successfully added.'
redirect_to(@booking)
else
flash[:notice] = 'Booking was not successfully added...'
render :action => 'new'
end
end
def destroy
@booking = Booking.find(params[:id])
@booking.destroy
flash[:notice] = 'Booking was successfully deleted.'
redirect_to bookings_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment