Designing Your Backend for Better User Experience (Ruby on Rails)

45 %
55 %
Information about Designing Your Backend for Better User Experience (Ruby on Rails)

Published on March 19, 2014

Author: lizhubertz



This is a quick beginner tutorial on how to avoid user error disaster in Ruby on Rails apps. By adding is_active to your database migrations, you can easily restore "destroyed" user data without a change to your user experience.


Q: WHO ARE YOUR USERS? A. People who attend tech Meetups B. My 90-year-old grandmother who uses IE C. A 14-year-old kid on her parents’ iPad D. Some sassy woman in Spain E. None and/or All of the Above


THE RESULT • No matter how much time you put into optimizing user experience, there will always be people who defy expectations. • Accidents will happen. • Accounts will be deleted. • You must be your users’ source control. DON’T WORRY. I GOT THIS.

THE WORKAROUND: IS_ACTIVE • Create a database migration to add column is_active to tables prone to disaster. Which can be ANYTHING a user has the power to destroy - users, registries, items, reservations, etc. • Command line: rails g migration add_is_active

YOUR MODELS: OVERRIDE DESTROY • Now, your problem records live on FOREVER…just in case you need to switch them back to active. • P.S. - Difference between the destroy method and the delete method. You could override the delete method, but then you don’t get callbacks like before_destroy.

DEFAULT SCOPE (HIDE THE INACTIVE STUFF BY DEFAULT) • RegItem.all # SELECT * FROM reg_items WHERE is_active = true; • Reference: Base/default_scope/class

UNSCOPED (OK FIND THE INACTIVE STUFF SOMETIMES) • Example: Item on registry was deleted by accident. User freaking out because it was this random onesie on Etsy they’ll never be able to find again. Customer support needs to run a query to find the name of the deleted item. • Source: Base/unscoped/class

BENEFITS TO THIS APPROACH • Key user information is never destroyed, so data restoration is 100% possible. Happy users! • Restoration is as simple as changing the is_active column to “true” - which means super easy integration for an admin panel. Happy customer support people! • More data is saved about user behavior. (“On average, accidental deletes happen for 50% of our registry items. Something must be wrong with our user interface.”) • Simple UI - Users never need to know what they’re doing behind the scenes. There’s no record on their end of inactive vs. active objects. They think they’re just deleting as normal and then assume you have magic powers. Yay!


Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

ruby on rails - back-end and front-end options in RoR3 ...

Join the Stack Overflow community to: Ask programming questions Answer and help your peers Get recognized for your expertise
Read more

Java Backend and Rails Frontend - Stack Overflow

Java Backend and Rails ... how many people do you have with experience designing Rails systems that use Java on the ... better than Rails on Ruby 1 ...
Read more

A Comparison of Frontend and Backend Web Development

A Comparison of Frontend and Backend Web ... can be attributed to a better frontend and user experience. ... and / or still use Ruby on Rails in some ...
Read more

Ruby on Rails (web framework) - Quora

Ruby on Rails (web framework). ... My company uses Rails as backend for developing JSON Api. ... How can I get better at using Ruby on Rails?
Read more

Ruby on Rails

Ruby on Rails is open source software, so not only is it free to use, you can also help make it better.
Read more

Rails + Angular / Rails + Ember - airpair | Coding help ...

Rails JS frameworks: Ember.js vs ... offer our users a better or more interactive experience using ... with our Rails backend. App.User = DS ...
Read more

Ruby on Rails Training - Back-end Web Development ...

User Experience Design Immersive; ... Meet your support team. ... This course is an introduction to web development with Ruby on Rails.
Read more

Peter Christensen | LinkedIn

View Peter Christensen’s ... Develop front and backend code to improve fluid user experiences. ... Peter worked with us at Better as a Ruby on Rails ...
Read more

The Iron Yard - Ruby on Rails

... with popularity exploding in 2005 with the release of Ruby on Rails. Ruby is ... stressing user experiences and ... into your Rails ...
Read more