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.
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:
- Create a form in Forms, to allow people to book.
- Link Forms to Sharepoint with Flow: so everytime someone books a room, update a Sharepoint list
- Create mobile app, using Power Apps, that allows you to fill out the Forms, but it feels like a native mobile app
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.
This is kinda the process I followed:
- Install Ruby and Rails
- Use any IDE, I chose to use Cloud9 on AWS
- Create the rails app
rails _5.1.4_ new pod_bookings
scaffoldto 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
- Update the DB - SQLite for testing, and PG on Heroku
- Update routes: URLs to lauch actions
routes.rb: root 'bookings#index'
- Test locally, and then deploy to Heroku