Systems | Development | Analytics | API | Testing

AppSignal

An Introduction to RuboCop for Ruby on Rails

Good code has a lot to do with how readable it is. As developers, we more often read code than write it. As my Perl teacher told us many times: the flexibility of Perl's syntax was its best and worst trait at the same time. Ruby's syntax was influenced partly by Perl and is also quite flexible. Whatever language you pick, set some guidelines to avoid overusing a language's flexibility. Style guides for Ruby abound on the web, and it's not difficult to pick a style nowadays.

Writing a Custom Credo Check in Elixir

Static code analysis is an important tool to ensure a project meets the right code standards and quality. In Elixir, the most popular package for this is Credo. Not only does it offer dozens of pre-made checks, but it also allows you to create your own. In this article, we will walk you through creating a Credo check. We will see how to write the code, enable the check in the Credo config, and make it nice to use. Let’s start!

Secure Your Ruby App with JSON Web Tokens

If a web application involves users, as a matter of course, their data should be protected and secured. Securing a web application can mean several things. In this post, we'll discuss a subset of web security that involves authentication using JSON Web Tokens (JWTs) and the Ruby on Rails web application framework. Let's get started!

Pitfalls to Avoid in Playwright for Node.js

Automation testing has become a fundamental part of web development, and Playwright has emerged as one of the most powerful end-to-end testing tools. Thanks to its robust API and multi-browser support, it's easy to test sites and web apps. At the same time, Playwright can present some challenges if not approached correctly. Several pitfalls can compromise the effectiveness and performance of your tests, potentially leading to inaccurate results.

How to Use MongoDB and Mongoose with Node.js

Mongoose is Object Data Modeling (ODM) for MongoDB. It represents application data as JavaScript objects, mapped to the underlying MongoDB database. You can use Mongoose to model data, enforce schemas, validate models, and manipulate data in a database without familiarity with the underlying database semantics. In this tutorial, you will build an Express server with Mongoose that serves a RESTful API. Let's get started!

A Deep Dive into Subscriptions with Absinthe

In this series, we've seen how to create GraphQL APIs in Elixir using Absinthe. So far, we have only discussed a one-way communication channel where the client makes the queries or mutations, and the server responds. GraphQL also supports a long-running subscription between the client and the server where the server can notify the client of events. This can be very useful in multi-user scenarios where many users might interact with the same resource at the same time.

Add a Form to a Modal in Phoenix 1.7

In part one of this series, we introduced the core generated components when bootstrapping a new Phoenix project. We used a button and a modal from the core components to lay the groundwork for a "create modal". In this post, we will put a form onto the modal and create pets. Let's get started! Note: As in the last post, you can follow along with our companion repo.

An Introduction to Metaprogramming in Ruby

You've heard of metaprogramming: code you write that generates other code dynamically. Without it, Rails as we know it wouldn't (and couldn't) exist. But there's a good chance you've never done it yourself, and it's not hard to see why; even a brief excursion into the realm of metaprogramming can leave you beset with strange and foreign methods, unfamiliar syntax, and downright mystifying blocks of code.

How to Delegate Methods in Ruby

Delegation in programming refers to handing off a task from one part of a program to another. It's an essential technique in object-oriented programming, empowering clean, maintainable code by ensuring that each object or method is responsible for a specific task or behavior. Understanding and using delegation is key to mastering Ruby and other object-oriented languages. Delegation promotes separation of concerns, making your code more modular and easier to understand, test, and refactor.