---
title: "Discussion on \"Some Best Practices in Ruby on Rails\" | Hashnode"
description: "Discussion on \"Some Best Practices in Ruby on Rails\". Use ‘each’ instead of ‘for’\n\n\nfor elem in [1, 2, 3, 4, 5]\nputs elem\nend\n\n[1, 2, 3, 4, 5].each { |elem| puts elem }\n\nUse ‘Case/when’ conditions instead of lengthy “if” statements\n\n\nputs \"What is your task status?\"\nstatus= gets.chomp\n\ncase status\nwhen ..."
url: "https://hashnode.com/posts/some-best-practices-in-ruby-on-rails/6200babf295d276006775bec"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Some Best Practices in Ruby on Rails](https://developerstack.hashnode.dev/some-best-practices-in-ruby-on-rails?utm_source=hashnode&utm_medium=feed)

Use ‘each’ instead of ‘for’ for elem in \[1, 2, 3, 4, 5\] puts elem end \[1, 2, 3, 4, 5\].each { |elem| puts elem } Use ‘Case/when’ conditions instead of lengthy “if” statements puts "What is your task status?" status= gets.chomp case status when ...

Feb 7, 2022 · 7 min read · developerstack.hashnode.dev  
Read the article

-   [#ruby](https://hashnode.com/tag/ruby)
-   [#ruby-on-rails](https://hashnode.com/tag/ruby-on-rails)
-   [#best-practices](https://hashnode.com/tag/best-practices)

## Written by

[Sanima Shrestha](https://hashnode.com/@Syslin)

@Syslin · Nepal

  
[View profile](https://hashnode.com/@Syslin)

Developer

I am a Ruby on Rails developer from Nepal.

## Responses 1

Markdown supported · ⌘↵ to post

[Sabarish Rajamohan](https://hashnode.com/@sabarish)

[Feb 7, 2022](https://hashnode.com/posts/some-best-practices-in-ruby-on-rails/6200babf295d276006775bec/comment/6201355f295d276006776dd9)

This is a nice set of best practices to have in mind while working with Rails [Sanima Shrestha](https://hashnode.com/@Syslin)
