DEV Community

Abhinav Saxena
Abhinav Saxena

Posted on • Updated on • Originally published at abhinav.co

8 useful Rails Bytes to improve your development process

Rails Bytes is a platform created by Chris Oliver aka excid3 to share useful Ruby on Rails recipes/templates. These templates allow you to add features to both old and new apps. In the background, these templates may install a gem, run their installation steps, or edit configurations themselves. Of late, I have been using Rails Bytes for my new Rails apps, and here are a few of them (in no particular order) which I find very useful.

  • HAML: Add beautifully DRY, well-indented, clear markup. I particularly enjoy writing clean markup, and I absolutely love HAML It also helps me understand the logic and intent clearly without getting lost in HTML. This template also lets you automatically convert your .erb files to .haml files. You also get an option to retain your .erb files in case you want to go back.
rails app:template LOCATION='https://railsbytes.com/script/x7msKK'
Enter fullscreen mode Exit fullscreen mode
  • Live Reload: LiveReload with Webpack for views and viewcomponents. I was recently exposed to Gatsby, and live reloading added so much to my productivity. Live Reload template tries to emulate the same for Rails. It used webpacker. There's another template on Rails Bytes which achieves the same using guard.
rails app:template LOCATION='https://railsbytes.com/script/V1bs61'
Enter fullscreen mode Exit fullscreen mode
rails app:template LOCATION='https://railsbytes.com/script/zOvsQ0'
Enter fullscreen mode Exit fullscreen mode
  • Simple form: Rails forms made easy. Rails default forms abstract native HTML forms well, Simple form takes this abstraction a little further and helps you create forms easily.
rails app:template LOCATION='https://railsbytes.com/script/VQLslK'
Enter fullscreen mode Exit fullscreen mode
  • Recreate: Rake task to drop schema and recreate the database. I am not sure if it's only me - but because of multiple reasons, I tend to recreate my development database numerous times. Rake task added by this template makes it very easy to do.
rails app:template LOCATION='https://railsbytes.com/script/VQLsoK'
Enter fullscreen mode Exit fullscreen mode
  • Annotate: Annotate Rails classes with schema and routes info. Rails does magic with ActiveRecord, and while I completely love it, I also need to refer to column names very frequently. This template and underlying gem help you achieve that.
rails app:template LOCATION='https://railsbytes.com/script/Vqqsqg'
Enter fullscreen mode Exit fullscreen mode
  • Strong Versions: Ensure your gems are appropriately versioned. I have seen production issues arising because of version mismatch of gems and other external libraries. Install strong_versions gem to enforce stricter policy on your Gemfile requirements.
rails app:template LOCATION='https://railsbytes.com/script/xjNsMn'
Enter fullscreen mode Exit fullscreen mode
  • High Voltage: Add High Voltage to manage static pages. There are static pages in every app, and High Voltage using a good convention saves you from building unnecessary controllers for static pages. For more details check out High Voltage gem.
rails app:template LOCATION='https://railsbytes.com/script/XbBsdZ'
Enter fullscreen mode Exit fullscreen mode

(cross-post from my personal blog)

Latest comments (0)