POST DIRECTORY

Rails

 

At Haught Codeworks the team is always working on many different projects, so it’s very important that developers can become productive quickly on any of them. This is necessary both for developers new to a project and trying to come up to speed, as well as developers familiar with a project that have been away from it for a while. We’ve found that...

 

Since Rails v4.1 is coming to its end of life, we recently upgraded one of our clients to Rails v4.2.8. And while most of the upgrade tasks were pretty straight forward, we did run into an interesting issue when using find_by_sql to execute a complex sql query. With the introduction of AdequateRecord, Rails is trying to improve query performance...

 

I’ve been working on a Rails 5 project that employs an infinite loop in conjunction with a few nested breakable loops. Code/case coverage is particularly important, as the program interacts with Cryptocurrency exchanges. Errors or unexpected behaviors can potentially result in financial loss.

I was expecting the loop tests to be convoluted, heavy...

 

Recently, a project we’ve been working on at Haught Codeworks got to the point where we needed to add additional columns to the database for one particular model. This meant that for any future instances of this model, those columns could be populated upon creating the instance, but any past instances would not have those fields associated with them...

 

In the last article we looked at using Ecto schemas to read records and associations from a database built according to Rails naming conventions. This time we will extend the examples used in that article to see how Ecto changesets can help us write records to the database in a safe and consistent way.

The example apps can be found at PlaygroundRails

 

I recently migrated a Rails JSONAPI server to Phoenix, and in the process I learned a lot about using Ecto with a database that conforms to Rails naming conventions. It turned out that I was able to share an existing Rails database between the Rails and Phoenix implementations of the server during development, which allowed me to use a phased approach...

 

In Rails apps, you have probably seen ActiveRecord queries chained together in a controller action in order to determine what information from the database is presented to the view. Query methods can be chained if they are being done on an ActiveRecord relation. If a method returns an object, it has to be at the end of a chain. Most often, a query...

 

In a previous post, I described a few ways to use seeds in a Rails app. Here I want to bring to life the real challenges in using seeds and what I learned about seeds through a project’s life cycle.

As the project matured, our seeds.rb file became less used and poorly maintained. It used to be a reliable way to create a starter set of objects that...

 

I recently worked with a data heavy Ruby on Rails project where seeds became crucial to developing quickly. I came to realize there are at least two different ways to use seeds, even though little has been written about these ways and there is no prescribed Rails Way. Here I aim to clarify the approaches, and in the next post I describe how our use...

 

I spent time over the past week building a form that went through some interesting iterations. The form involved a few nested associations, and had initially been built using JavaScript to incorporate drop downs, but my team decided to go back to a simpler Rails form and rebuild functionality from there. I’ll walk through the steps I took, and the...

 

Since joining Haught Codeworks as an apprentice one month ago, I’ve spent a lot of time working with two particular gems, Administrate and Devise, in two different apps. This has led me to think about the magic and potential convenience that come with gems versus the customization and knowledge that come with building something yourself.

When it...