Created
June 29, 2010 06:52
-
-
Save KamaKAzii/456889 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
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