We spend so much time obsessing over where code belongs, except when talking about views. In Ruby on Rails, it seems to mostly be a conversation about business logic and the complexity that ensues. Skinny Controllers, Fat Models! Skinny Controllers, Skinny Models, Use Service Objects! Etc… Something happens once that conversation ends: we move on, and […]
Using scopes in Ruby on Rails can help you write better, testable, more modular code. Let’s walk through a couple of use cases for scopes. First of all, if you’ve ever used Ruby on Rails, you’ve probably used ActiveRecord. (Hopefully not in your views!) ActiveRecord is a robust toolset. Specifically, let’s look at querying data. […]
* This post is for those newer to Ruby on Rails and/or MVC. However, it might serve as a refresher to others. Ruby on Rails gives developers tools to build web applications rapidly. “Convention over configuration” means that a lot of decisions are made for you. Take, for example, ActiveRecord. You don’t have to concern yourself […]
Chris Oliver (GoRails) and I were talking about the Rails ecosystem recently when he dropped a bombshell on me: I’m making a way for people to provision their own own Rails’ servers As someone who admires the Laravel ecosystem, I had become increasingly jealous of Laravel Forge. When Chris broke the news to me that we’d […]
I think a lot about Ruby; it’s community, and how people are using Ruby. I decided that I would run a survey to see if I could get some real data to accompany my thoughts. This survey was my first, and I’ve learned some better questions to ask in the future. I’ll likely be running this […]
I had the incredible opportunity to speak at CodeDaze 2016. I was able to talk about something that has sparked a lot of interest in me over the last year, Hanami.
I ran across something the other night in Rails 5 that I want to share. Let’s say you have code similar to the following: This code works fine as long a user has an organization. If you try to save a user and organization_id is blank, you’d get the error: Organization can’t be blank. This […]