December 28, 2017

Using Rails to build a Room booking system

Challenge: new Pods were installed at the office, and we needed a quick solution to book them for us.

Solution 1

Because our company is on Office365, we have available to us the wide ranges of O365 tools that Microsoft has building, and they really are impressive:

  • Teams: The Slack equivalent, this looks like a really good tool to work across teams. It includes IM/Chat, phone and PC apps, wiki and file management. Really impressive
  • Flow: an IFTTT for O365, Flow can link any data or app in the O365 ecosystem to each other, like linking Sharepoint to OneDrive, or Planner to Tasks, etc.
  • A wide range of mobile apps: Microsoft Apps has a link to most of them: Kaizala, PowerApps

So the quick solution for Room Booking involved:

  1. Create a form in Forms, to allow people to book.
  2. Link Forms to Sharepoint with Flow: so everytime someone books a room, update a Sharepoint list
  3. Create mobile app, using Power Apps, that allows you to fill out the Forms, but it feels like a native mobile app

Solution 2:

The not-so-quick solution was to write a Rails app, that makes available:

  • a web front-end to do bookings
  • an API

Create a mobile app, which is just a mobile view/thin-client, which calls the API, where all the logic and data sits.

I kinda followed this really good Rails tutorial, and so far I have managed to get a quick site up, hosted on Heroku:

This is kinda the process I followed:

  1. Install Ruby and Rails
  2. Use any IDE, I chose to use Cloud9 on AWS
  3. Create the rails app
rails _5.1.4_ new pod_bookings
  1. Use scaffold to auto-create forms and views, and the full MVC stack
rails generate scaffold Pod name:string location:string

rails generate scaffold Booking booking_name:string booking_email:string booking_start:datetime booking_end:datetime subject:string
rails generate scaffold Booking name:string email:string start:datetime end:datetime pod_id:integer pod_name:string
  1. Update the DB - SQLite for testing, and PG on Heroku
rails db:migrate
  1. Update routes: URLs to lauch actions
routes.rb: root 'bookings#index'
  1. Test locally, and then deploy to Heroku
  • LinkedIn
  • Reddit
  • Google+
  • Pinterest
  • Pocket