Bookable is a Rails 4.0 gem that enables you to add resource booking functionality to your Rails application. A resource can be anything that is bookable e.g. tennis court, football pitch, bowling lane, function room, conference room, office space.
Bookable works with Rails 4.0. Add this line to your application's Gemfile:
gem 'bookable', '~> 0.0.52'
Then execute:
$ bundle
Or install it yourself as:
$ gem install bookable
After you've installed the gem, you need to run the generator:
$ rails generate bookable:install
Alternatively you can specify a named resource by providing an argument to the rails generate command e.g.
$ rails generate bookable:install tennis_court
The generator will create the file structure you need to implement booking functionality into your app:
- controllers
- models - resource(tennis_court) and booking
- views
- javascript - which uses the jquery fullcalendar plugin
- css - some basic css is provided which you may want to override
$ rake db:migrate
Validations have been created for the models to ensure that a bookable resource is created with a unique name and bookings are created in the future and resources are not double booked. For further information, refer to the tests and for an example of how the gem is used, visit this site.
- Front end Date validation, for example 30th February is not a valid date but is permitted by the calendar view.
- Implement server side date validation for above - currently if a booking for 30th February is entered, the booking will be created for 2nd March.
There are a number of desired features we hope to implement in the future. If you wish to contribute please do so in the following manner.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
- optional description attribute for booking and resource models
- implement show route for bookings
- provide fix for Known Bugs
Bookable is released under the MIT License.