window.pipedriveLeadboosterConfig = { base: 'leadbooster-chat.pipedrive.com', companyId: 11580370, playbookUuid: '22236db1-6d50-40c4-b48f-8b11262155be', version: 2, } ;(function () { var w = window if (w.LeadBooster) { console.warn('LeadBooster already exists') } else { w.LeadBooster = { q: [], on: function (n, h) { this.q.push({ t: 'o', n: n, h: h }) }, trigger: function (n) { this.q.push({ t: 't', n: n }) }, } } })() Rails and Other Means of Transport - The Codest
The Codest
  • About us
  • Services
    • Software Development
      • Frontend Development
      • Backend Development
    • Staff Augmentation
      • Frontend Developers
      • Backend Developers
      • Data Engineers
      • Cloud Engineers
      • QA Engineers
      • Other
    • It Advisory
      • Audit & Consulting
  • Industries
    • Fintech & Banking
    • E-commerce
    • Adtech
    • Healthtech
    • Manufacturing
    • Logistics
    • Automotive
    • IOT
  • Value for
    • CEO
    • CTO
    • Delivery Manager
  • Our team
  • Case Studies
  • Know How
    • Blog
    • Meetups
    • Webinars
    • Resources
Careers Get in touch
  • About us
  • Services
    • Software Development
      • Frontend Development
      • Backend Development
    • Staff Augmentation
      • Frontend Developers
      • Backend Developers
      • Data Engineers
      • Cloud Engineers
      • QA Engineers
      • Other
    • It Advisory
      • Audit & Consulting
  • Value for
    • CEO
    • CTO
    • Delivery Manager
  • Our team
  • Case Studies
  • Know How
    • Blog
    • Meetups
    • Webinars
    • Resources
Careers Get in touch
Back arrow GO BACK
2021-06-30
Software Development

Rails and Other Means of Transport

The Codest

Krzysztof Buszewicz

Senior Software Engineer

Rails is a Rack-compatible framework focused on quick application development. Unfortunately, the “everything out of the box” approach and blind Rails-way behavior often cause the application code to lose quality, both in terms of its reception (readability) and operation.

Popular Rails and Rails-way problems

Problems mentioned in: article on Shopify

  • routing,
  • before-actions,
  • large actions in controllers,
  • private methods in controllers,
  • mixins used once,
  • logic in views,
  • ActiveRecord callbacks,
  • Associations,
  • “fat models.”

Additional problems

  • Active Record Validations,
  • implicit over explicit,
  • abuse of DRY,
  • delegations to associations,
  • service calls in models.

Alternatives to Rails

When it comes to Rails in the Ruby world, we have several alternatives. Other frameworks based on Rack include: – Sinatra, – Roda, – Hanami.

What makes them unique?

Both Sinatra and Roda offer us a block routing syntax, but routing in Sinatra is a list and in Roda – a tree. In both frameworks, we have to deal with the implementation of the model layer ourselves. In the case of Roda, it is a good idea to use the Sequel gem.

Roda is inspired by Sinatra. It is very light in itself, but it has a lot of plugins.

Hanami is the closest to Rails when it comes to areas covered by the framework. The most important differences in terms of use are:

  • controllers in Rails vs. actions in Hanami,
  • dedicated classes / objects handling a specific HTTP request, not one controller for actions related to a specific resource (model),
  • model layer based on repositories and entities, separating persistence from the rest of the application, not the active record pattern.

Hanami version 1 strongly limits the use of ROM it is based on (version 3, and it is already 5), so it is not worth using the model layer proposed there. However, as it is a very open framework, it is quite easy to implement there the model your own.

Supplements for Rails

It’s worth using solutions that aren’t dependent on Rails and are closer to “pure” Ruby. The tools mentioned in the presentation are:

  • Sequel (ORM, alternative to ActiveRecord),
  • ROM (object mapper),
  • dry-rb libraries: dry-validations, dry-system and dry-monads.

Sequel is easy to put in a project, it is based on plugins and also implements the active record pattern. It has better low-level query support than Rails‘ ActiveRecord.

ROM uses Sequel, but its concept is to translate between records in the database(s) and Ruby objects. It aims for speed and data transformation. Clearly separates the persistence layer in the application.

Dry-rb libraries are very useful tools:

  • dry-validation is very easy to use in API projects and allows for great control over the correctness of incoming data,
  • dry-system needs a bit of pratcice and patience for the developers to understand it, but it allows for very flexible management of dependencies in the application and loading project components in isolation; if we want to use this library in Rails, we can use dry-rails,
  • dry-monads is a difficult concept in theory, but in practice it is easier to understand, the result monads can be a great way to increase the readability of code by considering specific cases instead of branching ifs.

Conclusions

It’s best to use Rails so that you don’t have to use Rails one day.

Sources

Articles

  • Code Smells in Rails Apps (by Shopify)
  • Hanami: repozytoria
  • Rails Guides

Frameworks

  • Sinatra
  • Roda
  • Hanami

Gems

  • Sequel
  • ROM
  • Biblioteki dry-rb
  • Ruby JSON Schema Validator (json-schema)
  • Pagy
  • Rodauth
  • rodauth-rails

Specifications

  • Rack
  • JSON Schema

Read more:

What is Ruby on Jets and how to build an app using it?

Vuelendar. A new Codest’s project based on Vue.js

Codest’s weekly report of best tech articles. Building software for 50M concurrent sockets (10)

Related articles

Software Development

Build Future-Proof Web Apps: Insights from The Codest’s Expert Team

Discover how The Codest excels in creating scalable, interactive web applications with cutting-edge technologies, delivering seamless user experiences across all platforms. Learn how our expertise drives digital transformation and business...

THECODEST
Software Development

Top 10 Latvia-Based Software Development Companies

Learn about Latvia's top software development companies and their innovative solutions in our latest article. Discover how these tech leaders can help elevate your business.

thecodest
Enterprise & Scaleups Solutions

Java Software Development Essentials: A Guide to Outsourcing Successfully

Explore this essential guide on successfully outsourcing Java software development to enhance efficiency, access expertise, and drive project success with The Codest.

thecodest
Software Development

The Ultimate Guide to Outsourcing in Poland

The surge in outsourcing in Poland is driven by economic, educational, and technological advancements, fostering IT growth and a business-friendly climate.

TheCodest
Enterprise & Scaleups Solutions

The Complete Guide to IT Audit Tools and Techniques

IT audits ensure secure, efficient, and compliant systems. Learn more about their importance by reading the full article.

The Codest
Jakub Jakubowicz CTO & Co-Founder

Subscribe to our knowledge base and stay up to date on the expertise from the IT sector.

    About us

    The Codest – International software development company with tech hubs in Poland.

    United Kingdom - Headquarters

    • Office 303B, 182-184 High Street North E6 2JA
      London, England

    Poland - Local Tech Hubs

    • Fabryczna Office Park, Aleja
      Pokoju 18, 31-564 Kraków
    • Brain Embassy, Konstruktorska
      11, 02-673 Warsaw, Poland

      The Codest

    • Home
    • About us
    • Services
    • Case Studies
    • Know How
    • Careers
    • Dictionary

      Services

    • It Advisory
    • Software Development
    • Backend Development
    • Frontend Development
    • Staff Augmentation
    • Backend Developers
    • Cloud Engineers
    • Data Engineers
    • Other
    • QA Engineers

      Resources

    • Facts and Myths about Cooperating with External Software Development Partner
    • From the USA to Europe: Why do American startups decide to relocate to Europe
    • Tech Offshore Development Hubs Comparison: Tech Offshore Europe (Poland), ASEAN (Philippines), Eurasia (Turkey)
    • What are the top CTOs and CIOs Challenges?
    • The Codest
    • The Codest
    • The Codest
    • Privacy policy
    • Website terms of use

    Copyright © 2025 by The Codest. All rights reserved.

    en_USEnglish
    de_DEGerman sv_SESwedish da_DKDanish nb_NONorwegian fiFinnish fr_FRFrench pl_PLPolish arArabic it_ITItalian jaJapanese ko_KRKorean es_ESSpanish nl_NLDutch etEstonian elGreek en_USEnglish