In its eleventh year as an open source project, we have decided to halt work on Paperclip. This comes from a combination of already slowed work on the project, a constantly growing list of issues and pull requests that we struggle to keep on top of, and most recently the release of ActiveStorage in Rails 5.2. Migrating For moving from Paperclip to ActiveStorage, please see the migration guide. As
We work a sustainable pace on client work. We also reserve at least 20 days per year of our working time for continuous improvement, which we call "investment time." When taking time off during client work, we discuss how it will impact the schedule with other team members. Sending off-hours communication may create an unintended sense of urgency with the recipients of the message, so we try to av
Polymorphism - the provision of a single interface to entities of different types Polymorphism is one of the fundamental features of object oriented programming, but what exactly does it mean? At its core, in Ruby, it means being able to send the same message to different objects and get different results. Let’s look at a few different ways to achieve this. Inheritance One way we can achieve polym
# app/models/user.rb class User < ActiveRecord::Base has_secure_password has_many :posts end # app/models/post.rb class Post < ActiveRecord::Base belongs_to :user end # app/controllers/posts_controller.rb class PostsController < ApplicationController def show @post = Post.find(params[:id]) render json: @post.as_json( only: [:id, :content, :created_at], include: { user: { only: [:id, :username] } }
This post was originally published on the New Bamboo blog, before New Bamboo joined thoughtbot in London. I took the opportunity of our last New Bamboo Hack Day to write a Server Sent Events server in Go. The idea was to allow third parties to subscribe to a pre-existing, internal events stream for an e-commerce platform. I also needed to authenticate this service via access tokens so only authori
There are times in your tests when you need to create multiple instances of the same type of object. FactoryBot1 provides create_list for just these sorts of scenarios. It’s typically sufficient to create two records in these cases, but create_list leaves open the possibility that you could unintentionally create many more records. Consider, for example, testing a feature that pages in additional
I’ve been using tmux for about six months now and it has become just as essential to my workflow as vim. Pane and window management, copy-mode for navigating output, and session management make it a no-brainer for those who live in the terminal (and especially vim). I’ve compiled a list of tmux commands I use daily to help me work more efficiently. Shortcuts If a tmux command I mention is bound to
“Please rebase on top of main and we’ll merge your pull request”. “Can you please squash your commits together so we get a clean, reversible git history?”. “Can you rewrite your commit’s message to describe better the problem it solves, and how it solves it?”. Questions like these are commonly asked in pull requests. Let’s see why they exist, how to perform them, and their possible problems. Chang
Want to see the full-length video right now for free? Sign In with GitHub for Free Access This week, Chris is joined by thoughtbot's Development Director in Boston, Josh Clayton, to talk about factory_bot; a topic near and dear to Josh's heart, as he's been the maintainer of the project for over five years. FactoryBot is one of thoughtbot's most popular open-source projects, and is one of the few
Ruby 2.5 introduces Object#yield_self, which can be thought of as a close cousin to Object#tap. Where tap executes a block returning the value it’s called on, yield_self yields the object its called on into the supplied block, returning the result of the block. Many have compared yield_self to Elixir’s pipe operator, |>, and while I use and enjoy the pipe operator in Elixir, I had a hard time envi
Have you ever needed to write a query that combined data from two PostgreSQL databases? Our client Healthify has. Since Healthify work with healthcare and store some patient information, they’re very careful not to send any personally identifiable information to third party services. One such service is Segment, which Healthify use to track user activity on the site. Conveniently, Segment can send
Maybe has a tendency to take over your codebase. This property is sometimes described as being viral. Uncertainty begets uncertainty. This sort of defeats the goal of using Maybe in the first place: give you confidence in the presence of most values. By slightly changing our approach to solving problems involving uncertainty, we can contain Maybe to those parts of our code that are truly optional.
Our world is full of uncertainty. This uncertainty bleeds into our programs. A common way of dealing with this is null/nil. Unfortunately, this leads to even more uncertainty because this design means any value in our system could be null unless we’ve explicitly checked it’s presence. Constantly checking the presence of every value is a lot of work so we tend to only check the riskiest places and
SVGs can be messy to develop with, often times being exported from a graphics application and being pasted into a document. However, they become much more delightful to work with when you have a readable file and clean markup. Optimizing SVG for the web When an SVG is exported from an application, it usually comes with code that’s unnecessary for rendering it on the web. For example, in Sketch, th
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く