Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
RubyGarage Blog 

International Ruby Conferences Spring 2018

Spring is the perfect time to regain strength, try a new hobby, and master your development skills. Are you a devoted Ruby fan? We’ve created a list of must-visit conferences this spring, enlightened keynote speakers, and major topics. Read, choose, attend, and get inspiration for your future work. #1. RubyConf AU https://rubygarage.s3.amazonaws.com/uploads/article_image/file/1188/rubyconf-au-2018.png When: March 8–9 Where: Sydney, Australia RubyConf AU is returning to Sydney. This time, the conference will take place at the beautiful harbor. You’ll get to meet skilled Ruby professionals: Sandi Metz, the author of Practical Object-Oriented Design in Ruby (POODR) and 99 Bottles of OOP;…
Ruby Weekly 

#387: Ruby turns 25

Ruby Weekly Issue 387 — February 22, 2018
Dave Thomas
Rubyists have been leaving messages for Ruby 25th anniversary, being celebrated at an event in Japan this weekend. There’s also an entire hashtag, #ruby25th, on Twitter packed with messages including from folks like Aaron Patterson, DHH and Chad Fowler.


k0kubun
We’ve linked to some articles about the promising new ‘MJIT’ compiler recently, but here’s an update directly from the engineer working on it along with some history and benchmarks.


reinteractive  Sponsored
Our out-source DevOps solves the problems…
Engine Yard Blog 

How to Install Ruby on a Mac with chruby, rbenv, or RVM

This is a post on installing Ruby on a Mac. This should work on recent MacOS versions - El Capitan, Sierra, and High Sierra. First of all, Ruby is already pre-installed on your Mac. However, the pre-installed version is a few versions behind so we'll look into the other ways to install Ruby.

BigBinary Blog 

Rails 5.2 supports specifying default value for a class_attribute

This blog is part of our Rails 5.2 series.

It is very common to set a default value for a class_attribute.

Before Rails 5.2, to specify a default value for a class_attribute, we need to write as follows.

class ActivityLogger
  class_attribute :logger
  class_attribute :settings

  self.logger = Logger.new(STDOUT)
  self.settings = {}
end

As we can see above, it requires some additional keystrokes to set a default value for each class_attribute.

To make it easy, Rails 5.2 now has added support for specifying a default value for a class_attribute using default option.

class ActivityLogger
  class_attribute :logger, default: Logger.new(STDOUT)
  class_attribute :settings, default:…
JRuby.org News 

JRuby 9.1.16.0 Released

The JRuby community is pleased to announce the release of JRuby 9.1.16.0

JRuby 9.1.x is our current major version of JRuby. It is expected to be compatible with Ruby 2.3.x and stay in sync with C Ruby. JRuby 9.1.16.0 is our latest release…

Major features of JRuby 9000:

  • Ruby 2.x compatibility
  • A new optimizing runtime based on a traditional compiler design
  • New POSIX-friendly IO and Process
  • Fully ported encoding/transcoding logic from MRI

If you do find issues then report them on using our issue tracker at http://bugs.jruby.org. We also encourage users to join our IRC channel (#jruby on Freenode) and…

All Ruby Podcasts by Devchat.tv 

MRS 032: Corey Haines

Panel: Charles Max Wood

Guest: Corey Haines

This week on My Ruby Story, Charles talks to Corey Haines. Corey first got into programming because when his father shifted over into programming in the late 70’s, that meant that there was always a computer in the house when he was growing up. He grew up playing games on his father’s computer, and from there gained interest in code and programming. He talks about his love for Ruby and Rails as well as his proudest contributions to the Ruby community, such as the different communities of learning that he has impacted over the years.

In particular, we dive pretty deep on: 

  • How did you first get introduced into programming?
  • TRS 80 and WordStar
Hi, we're Arkency 

How Algolia built their frontend search widgets with React.js by following redux principles

When Algolia built their first version of Frontend Search Component called Instantsearch.js I was not particularly fond of this solution.

Some parts of our integration looked like this:

this.search.addWidget(
  DateRangeFilter({
    container: '#start_date_filter',
    attributeName: 'starts_at',
  })
);

this.search.addWidget(
  InstantSearch.widgets.pagination({
    container: '#pagination',
    cssClasses: {
      root: 'pagination pagination-centered'
    }
  })
);

this.search.addWidget(
  InstantSearch.widgets.searchBox({
    container: '#new_search',
    autofocus: false,
  })
);

this.search.addWidget(new GaIntegration());

this.search.addWidget(
  new WhenFilter({
    container:

Or this:

this.search = InstantSearch({
  appId: options.app_id,
  apiKey: options.api_key,
  indexName: options.index_name,
  urlSync: {
    mapping: {
      q:   'text',
      p:   'page',
      hFR: 'filter',
    },
    trackedParameters: [
      'query',
      'page',
      'attribute:category',
      'attribute:date',
      'attribute:minPrice',
      'aroundLatLng',
      'aroundRadiu…
Depfu 

Rethinking the dependencies badge

Why do we like repo badges? You know, these:

I think, fundamentally, it’s two things:

  • Surface information about this project that is otherwise a bit hidden
  • Show that we care about something

In the wake of the Gemnasium shutdown announcement a few of our users asked us to offer badges showing the state of dependencies of their repos. I wasn’t really excited about it and realized I was never a big fan of the dependencies badge, because it always looks like this:

I’m sure a lot of work went on in the Gemnasium back-end, tracking versions and comparing them to basically always show you: Guess what? You’re out of date.

I don’t believe we need badges that make maintainers feel…

Martian Chronicles, Evil Martians’ team blog 

Speaking with an accent

Authors: Andy Barnov, Writer at Evil Martians. Teacher at Le Wagon. Former international TV correspondent and Andrey Sitnik, PostCSS and Autoprefixer author, Lead Front-end Developer at Evil Martians

And getting over it. Read these tips from Andrey Sitnik, lead front-end developer at Evil Martians, creator of Autoprefixer and PostCSS, and learn how to get out of your comfort zone and on a major tech conference stage, even if your spoken English lags behind your programming skills.

Over the course of the last decade Andrey Sitnik, 30, spoke at dozens of conferences worldwide: from Tehran to New York. “Getting myself on a speakers list is my way of not paying an entry fee,” he jokes. In…

Blog - Sandi Metz 

What Does OO Afford?

I've been thinking about the affordances of programming languages.

A Little Background

In my previous post, Breaking Up the Behemoth, I posited an explanation for why OO apps so often evolve a few, disproportionally large, unmaintainable, condition-filled classes. Unfortunately, that post didn't offer a cure for this problem; it just gave the less-than-helpful advice that you avoid that situation.

This post continues to explore the problem of classes that get too large. My hope is by that learning to recognize the imminent appearance of the big-class-slippery-slope, you can avoid accidentally sliding down it.

Most of the ideas here are my opinion. Although this post starts out by examining…

Greater Than Code 

068: Skills of Resilience with Gerry Valentine

Support for the Greater Than Code podcast comes from the O’Reilly Velocity Conference. Join over 2000 developers and engineers in San Jose from June 11 to 14 to learn how to make your systems more scalable, resilient and secure. Get the latest on containers, microservices, infrastructure, cloud, DevOps, systems engineering, security, and more. Use discount code GTC20 to save 20% on your Gold, Silver or Bronze pass. Get all the details at velocityconf.com.

Panelists:

Jamey Hampton | Coraline Ada Ehmke

Guest Starring:

Gerry Valentine: @gerryval

Join Our Slack Channel!
Support us via Patreon!

Show Notes:

01:28 – Gerry’s Superpower: Building Resilience

02:51 – What is Resilience?

08:59 –…

All Ruby Podcasts by Devchat.tv 

RR 350: Episode 350 Celebration!

Panel: 

Charles Max Wood

Dave Kimura

David Richards

Special Guests: None

In this episode of Ruby Rogues, the panel discusses where they are right now and what their day to day looks like. Dave is with Sage Software and continues to push himself so that he will always be learning and progressing. He has three kids currently and he tries to have a good work-life balance so that he can separate both of his worlds. David is currently at a Fintech company where he is on the core team and does the data science. He also writes a lot and explores his creativity through that. Charles finds himself working a lot on the podcasts and has to schedule time to code. He works from home and therefore…

Test Double | Our Thinking 

Music Cards

Music Cards

Our family loves music. We almost always have some sort of music going on in the background at our house. We have a number of Sonos speakers and subscriptions to the major music providers, giving us a lot of flexibility in what to listen to and where.

Unfortunately, having the world's music at the ready has some downsides. Especially if you're four years old.

My daughter, Nika

This is Nika. She also loves music. Unfortunately, she does not yet know how to read, which is a real pain when she wants to pick out music. One option would be to buy CDs, but then she has to keep them from getting scratched and remember which tracks are the songs she likes. Also, we'd have to buy a huge amount of CDs…

Scout ~ The Blog 

Deploying a Faktory worker to AWS Fargate

Looking for a fresh, 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We're covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, setting up load balancing, SSL, CDN, and more.

In the previous post of this series, we deployed the Faktory service to AWS Fargate and created our first background job. Today we'll setup a Ruby worker service to pull jobs from the Faktory server and execute them.

Setting Up Our Worker Service

We need to set up a new task definition for our worker service, but it will use the same image our Rails app (the produciton demo app) is using.

Let's start by…

Julia Evans 

Measuring a blog's success: focus on conversations, not page views

I’ve been writing this blog now for a little over 4 years. I’ve found it to be a really rewarding and fun thing to do – more people than I can count have told me that this blog has helped them, lots of you have helped me figure things out, and just the act of writing down confusing things has taught me so much.

I want to talk a little about what what it means for a blog to be “successful” (and how I think about success for this blog) because I think independent blogs are kind of a wonderful + magical thing – I have a site that I own! And lots of people have signed up to get updates when I post, because they’re interested in what I’m saying. And there isn’t any other intermediary…

Creepy Wizard 

Rails Application Upgrades: Hard Mode

Last month Luke Francl published a great article titled “Upgrading a Rails application incrementally”. In it he lays out an approach for performing Rails version upgrades, specifically discussing his experience upgrading an app from Rails 3.2 to 4.2.

There’s a lot more to it, but his strategy hinges on parameterizing the dependencies of the application so that both the application and the test suite can run against multiple versions of Rails.

Application developers might not realize that having one codebase that runs against multiple versions of a gem is an option to them. On the other hand, gem maintainers are probably all aware of this. The Solidus extension ecosystem is an awesome…

Ruby Magic by AppSignal 

Syntactic sugar methods in Ruby

Welcome to a new Ruby Magic article! In this episode, we’ll look at how Ruby uses syntactic sugar to make some of its syntax more expressive, or easier to read. At the end, we’ll know how some of Ruby’s tricks work under the hood and how to write our own methods that use a bit of this sugar.

When writing Ruby apps it’s common to interact with class attributes, arrays and hashes in a way that may feel non-standard. How would we define methods to assign attributes and fetch values from an array or hash?

Ruby provides a bit of syntactic sugar to make these method work when calling them. In this post we’ll explore how that works.

1
2
3
4
5
6
7
8
9
person1 = Person.new
person1.name = "John"

ar…
JetRockets 

Ruby string literals VS Value objects. Overengineering?

A guide on how to get rid of string literals in Ruby with Rails 5 Attributes API
Valentino G. | Blog 

React: Re-render a Component On Route (or props) Change

A common scenario with React Router: re-render a component on route change.

React: re-render a component on route change

In other words: reloading/refreshing the same React component when visiting a link.

The same concept applies for re-rendering a component when props change.

How do you write such logic? Let’s find out together!

React: re-render a component on route change. The use case

React promotes component reusing.

You don’t want to write 2 different components for calling 2 separate endpoints.

It makes sense to have a single React component for calling the API endpoints depending on the location pathname.

Consider an application in which React router handles the routing part.

When visiting https://example.app/subscribers I…

An…

Paweł Urbanek - Web and Mobile Developer, Full Stack Blog 

Reconsider Blogging on Medium if You Care about SEO

Hammer represents that Medium is a wrong tool for your blog

Medium is an extremely popular blogging platform for both newcomers and expert tech-savvy bloggers. I’ve noticed the serious SEO related issue with using it as your main blogging tool. Read on if you are curious how Medium hurts your internet brand and what’s the alternative.

Authority of your domain (SEO ranking)

Search engine optimization is a complex subject. One of the few things that are known for sure is that so-called backlinks can improve website’s position in the search results. The more backlinks from good quality sources, the better it ranks in search results for a given term.

One caveat is that a backlink has to be an <a> HTML element without a rel="nofollow" added to it. A …

Julia Evans 

Profiler week 6/7: more experiments, and a `report` subcommand!

Hello! I didn’t write a profiler blog post last week, but I am writing one today!

The most exciting thing that happened in the last few weeks is – I think rbspy works. Like when I started out on this sabbatical, I was pretty worried that I wouldn’t be able to stabilize it and that it would always be kind of buggy and unstable.

I think it works, though! I haven’t gotten any new bug reports in a couple weeks, and all the bugs I’ve run into so far have been quite easy to fix. There is an issue where the Mac version is a little sketchy (because Mac systems programming is hard and I’m not planning to invest more time in it), but I feel good about the Linux version!

I’m sure there are still…

All Ruby Podcasts by Devchat.tv 

MRS 031: Jeremy Evans

Panel: Charles Max Wood

Guest: Jeremy Evans

This week on My Ruby Story, Charles talks to Jeremy Evans. Jeremy has been programming Ruby since 2004, and is best known for working on Roda and Sequel. He talks about his journey into programming, starting when he was in college and took an introduction to programming class that focused on C++, which he found interesting and then took the next courses in the series. This was just the beginning for his programming journey, though. Jeremy continues to talk about his present and future endeavors and how he is adding value to the Ruby community.

In particular, We dive pretty deep on: 

  • How did you first get introduced into programming?
  • Roda
Ilija Eftimov 

Data structures in Go: Linked lists

Data structures and algorithms are the bread and butter of computer science. Although sometimes they appear scary to people, most of them have a simple explanation. Also, when explained well with a problem algorithms can be interesting and fun to learn and apply.

This post is aimed at people that are not comfortable with linked lists, or folks that want to see and learn how to build one with Golang. We will see how we can implement them with Go via a (somewhat) practical example, instead of the plain theory and code examples.

But first, let’s touch on a bit of theory.

Linked lists

Linked lists are one of the simpler data structures out there. Wikipedia’s article on linked lists states…

Hi, we're Arkency 

The anatomy of search pages

What kind of components do we need to use to make a great search page? Let’s have a look.

Text Search

Search results

1

2

3

Filters

1

2

3

4

5

6

7

Custom components

1

2

3

4

Sorting components

1

2

3

Pagination and results summary

1

2

Easy?

I gathered some examples of the most typical components. How long do you think it would take your team to implement all of them. At the beginning, the task does not seem to be quite daunting. But the complexity comes from the fact that many of those components influence the search query, search results, and other components. As an example when a user keeps writing the search query, the list of categories (and their counters) is refreshed to…

Julia Evans 

Working remotely, 4 years in

I live in Montreal. 4 years ago, I decided to take a job working remotely for a company based in San Francisco. At the time, I was worried that it wouldn’t work out – I’d never worked remotely before, so it was a pretty big unknown for me. You can see me struggling with it on this blog after 3 months and 8 months. But Avi (one of the people who interviewed me, who works remotely) convinced me that it was a reasonable thing to try, and I could see that it was working for him, and I really liked all the people who interviewed me, so I decided to give it a shot.

It worked out. It obviously hasn’t always been 100% perfect in every way, but working remotely has been a great career move for…

On the Edge of Ruby 

TruffleRuby Native: Fast Even for Short Scripts

Introduction

Nowadays, it seems every major Ruby implementation has a Just-In-Time (JIT) compiler. Recently, YARV-MJIT has been merged to MRI (CRuby) trunk. JRuby relies on the Java Virtual Machine JIT compilers, and TruffleRuby uses Graal.

One big challenge for JIT compilers is to be beneficial on short-running scripts. In general, JIT compilers are better for long-running applications like web servers.

John Hawthorn Recently wrote a blog post about using YARV-MJIT for a small Ruby script. In this post, I want to expand on that and analyze the performance of 43 short-running programs (from 0.04s to 20s). Quick startup and fast warmup are therefore important to achieve good results.

JRu…

Sinatra 

Sinatra 2.0.1 is out!

I have just released Sinatra v2.0.1 and Mustermann v1.0.2.

Before we begin, I want to thank everyone who contributed, helped test pre-releases, and continues to use and support the project.

Security Fix CVE-2018-7212

The rack-protection-v2.0.1 contains a security fix for CVE-2018-7212.

It was determined a path traversal attack using backslashes was possible on Windows environment. We highly recommend you upgrade at least rack-protection if you’re on Windows, or apply this patch provided by Orange Tsai from DEVCORE.

If you’re on older version of Sinatra, we have backported this patch to rack-protection in v1.5.4.

Releases

Sinatra v2.0.1 includes the release of the following gems, and…

On the Edge of Ruby 

TruffleRuby Native: Fast Even for Short Scripts

Introduction

Nowadays, it seems every major Ruby implementation has a Just-In-Time (JIT) compiler. Recently, YARV-MJIT has been merged to MRI (CRuby) trunk. JRuby relies on the Java Virtual Machine JIT compilers, and TruffleRuby uses Graal.

One big challenge for JIT compilers is to be beneficial on short-running scripts. In general, JIT compilers are better for long-running applications like web servers.

John Hawthorn Recently wrote a blog post about using YARV-MJIT for a small Ruby script. In this post, I want to expand on that and analyze the performance of 43 short-running programs (from 0.04s to 20s). Quick startup and fast warmup are therefore important to achieve good results.

JRu…

Andy Croll 

Avoid Writing SQL When Using ActiveRelation

ActiveRelation, which powers the searching and querying engine of ActiveRecord, is a powerful and flexible tool.

Instead of…

…writing literal SQL strings with direct string interpolation inside an ActiveRelation #where method.

Person.where("name = #{ params[:name] } AND hidden_at IS NULL")

Or…

…writing literal SQL strings and using the ‘array style’ to safely interpolate user input.

Person.where('name = ? AND hidden_at IS NULL', params[:name])

Use…

…the ‘hash style’ syntax.

Person.where(name: params[:name], hidden_at: nil)

Why?

The first two versions, where you manually write SQL, were the only ways to specify database queries before ActiveRelation was merged into Rails (in…

Riding Rails 

Rails 5.1.5, parallel testing and more!

Hello everyone! This is Roque bringing you the latest news from the Rails world.

Rails 5.1.5 released 🎉

Release 5.1.5 is out, but you can still help the community by testing 5.2.0.rc1 to ensure it is solid.

This Week’s Contributors

26 people contributed to Rails the past week! If you’d like to join them, why not check out the list of open issues?

On writing software well: pilot episode

This is first of a serie of episodes recently released by DHH. Check out the full list on YouTube.

Parallel testing

In Rails 6.0.0, new application will run tests in parallel by default. The number of parallel workers is customizable, and which one will have its own temporary database. I recommend…

Ruby News 

Multiple vulnerabilities in RubyGems

There are multiple vulnerabilities in RubyGems bundled by Ruby. It is reported at the official blog of RubyGems.

Details

The following vulnerabilities have been reported.

  • Prevent path traversal when writing to a symlinked basedir outside of the root.
  • Fix possible Unsafe Object Deserialization Vulnerability in gem owner.
  • Strictly interpret octal fields in tar headers.
  • Raise a security error when there are duplicate files in a package.
  • Enforce URL validation on spec homepage attribute.
  • Mitigate XSS vulnerability in homepage attribute when displayed via gem server.
  • Prevent Path Traversal issue during gem installation.

It is strongly recommended for Ruby users to take one of…

Creepy Wizard 

Class Methods and Memoization

This is the first post in a series about common mistakes that lead to unreliable test suites in Ruby and how to fix them. Stay tuned for more.

Memoization is a helpful tool for optimization, but Rubyists use it for more than that. Take this class for, example:

class UserNotification
  def initialize(user)
    @user = user
  end

  def account_frozen
    return unless user.phone_number

    api_client.send(
      user.phone_number,
      "Your account has been frozen due to suspicious activity."
    )
  end

  private

  attr_reader :user

  def api_client
    @api_client ||=
      NotificationService::Client.new(key: ENV.fetch('NOTIFICATION_SERVICE_API_KEY'))
  end
end

In the class…

OmbuLabs Blog 

Upgrading a Huge Monolith from Rails 4.0 to Rails 5.1

We recently collaborated with Power Home Remodeling on a Rails upgrade for their self-described “monolith CRM/ERP application” and were able to speak to them about their experience with Ombu Labs.

We talked to Ben Langfeld, Application Solutions Architect at Power Home Remodeling, about the work on their app, Nitro. According to Ben, their monolithic CRM/ERP application is continuously built by a team of approximately 50 developers, system administrators, testers and support staff. The application contains over 500,000 lines of Ruby on Rails and Javascript code, and by their own definition, is one of the most complex Rails applications out there in terms of scope.

Like many companies, P…

RubyMine Blog 

Improved CSS, Extract Vue Component, and More on JavaScript in the Updated RubyMine 2018.1 EAP

Hey all,

RubyMine 2018.1 EAP3 (181.3741.30) is now available. With this build we’d like to tell you about the recent JavaScript improvements that the RubyMine 2018.1 Early Access Program inherits from WebStorm (our other IDE for JavaScript).

Improved CSS

You will find the updated list of SVG properties and values, as well as code completion and validation for their values that were not available before:

Download RubyMine 2018.1 EAP

Previously, when you cmd-clicked on a class name in the HTML file that had a link to a compiled CSS file, you were navigated to a class in the linked CSS file. Now the IDE suggests navigating both to the CSS file and the source file, if there are source maps,…

The Bike Shed 

143: It's Hard to Have a Secret Rocket

We chat about the Falcon Heavy launch before discussing a couple of issues Derek encountered when upgrading to Rails 5.2

Engine Yard Blog 

Goodbye ubygems

No we're not hating on RubyGems. This is about ubygems and that's not a typo. There was a file named ubygems.rb and it has been removed from Ruby 2.5.

Paweł Urbanek - Web and Mobile Developer, Full Stack Blog 

SEO Tips for Programming Blogs and Technical Bloggers in 2018

Spider web represents blog SEO optimization techniques

I’ve noticed that many programming blogs I read don’t implement certain simple SEO techniques, and bloggers could be missing valuable traffic opportunities. I will describe a couple of search engine optimization tips which can improve your technical blog’s SEO ranking and search results position in 2018. I will cover topics like Google’s Featured Snippets, AMP, best rendering speed tips and social media meta tags.

I use jekyll based pixyll template for this blog but most of the tips should be applicable to all custom blog engines. If you use Medium as your only blogging platform (protip: you probably shouldn’t) none of these tips will be applicable.

Here’s what you can do:

Add Open…

RubyGems Blog 

2.7.6 Released

RubyGems 2.7.6 includes security fixes.

To update to the latest RubyGems you can run:

gem update --system

If you need to upgrade or downgrade please follow the how to upgrade/downgrade RubyGems instructions. To install RubyGems by hand see the Download RubyGems page.

Security fixes:

  • Prevent path traversal when writing to a symlinked basedir outside of the root. Discovered by nmalkin, fixed by Jonathan Claudius and Samuel Giddins.
  • Fix possible Unsafe Object Deserialization Vulnerability in gem owner. Fixed by Jonathan Claudius.
  • Strictly interpret octal fields in tar headers. Discoved by plover, fixed by Samuel Giddins.
  • Raise a security error when there are duplicate files in…
Sam Saffron 

Reducing String duplication in Ruby

It is very likely your Rails application is full of duplicate strings, here are some tricks you can use to get rid of them.


One very common problem Ruby and Rails have is memory usage. Often when hosting sites the bottleneck is memory not performance. At Discourse we spend a fair amount of time tuning our application so self hosters can afford to host Discourse on 1GB droplets.

To help debug memory usage I created the memory_profiler gem, it allows you to easily report on application memory usage. I highly recommend you give it a shot on your Rails app, it is often surprising how much low hanging fruit there is. On unoptimized applications you can often reduce memory usage by 20-30% in a…

Memory…

Awesome Ruby Newsletter 

Issue 92 - The $500_000 version of MRuby: how Shopify spent half a million to fix MRuby security bugs last year.

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

Ruby for Good @ Washington D.C. (District of Columbia), United States - Ruby Conferences 'n' Camps Update

Conferences 'n' Camps

What's News? What's Upcoming in 2018?

Ruby for Good
Jun/7-10 (3d) Thu-Sun @ Washington D.C. (District of Columbia), United States • (Updates)

See all Conferences 'n' Camps in 2018 ».

Ruby Weekly 

#386: Speeding Up Ruby with Shared Strings

Ruby Weekly Issue 386 — February 15, 2018
Aaron 'tenderlove' Patterson
An in-depth explanation of a patch to Ruby that both reduces memory and speeds up performance (with require going 35% faster).


YouTube
The creator of Rails jumps back into screencasting with a look at how he works on Basecamp. There’s also a second episode where he looks at using callbacks to manage complexity.


Datadog  Sponsored
Visualize and alert on custom metrics in real-time with Datadog. Utilize distributed tracing and interactive flame graphs to gain…
Riding Rails 

Rails 5.1.5 has been released

Hi everyone,

I am happy to announce that Rails 5.1.5 has been released.

CHANGES since 5.1.4

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as the one I’ve uploaded, please use these SHA-256 hashes.

Here are the checksums for 5.1.5:

$ shasum -a 256…
Semaphore Engineering Blog 

7 Ways Continuous Delivery Helps Build a Culture of Learning

7 Ways Continuous Delivery Helps Build a Culture of Learning

At the heart of continuous delivery is a fast feedback loop that immediately shows developers the effects of their work. Mistakes are found and fixed quickly, while beneficial changes can be released and deployed to customers without having to wait for a distant future release date. This rapid feedback helps build an organizational culture of learning and responsibility.

The foundation is continuous integration: whenever developers commit new changes into version control, fast automated tests run in a production-like environment to ensure that both the code and the system as a whole are safe to deploy to users. In many cases, deployment is triggered automatically if tests have…

OmbuLabs Blog 

Cleaning up: ActiveRecord::Dirty 5.2 API Changes

With the release of Rails 5.2 just around the corner (Rails 5.2 RC1 is already available!), we will be taking a look at some of the upcoming changes to the ActiveRecord::Dirty module. If you're running Rails 5.1, you may have already seen some of the deprecation warnings related to the API changes contained in it. Most of them are behavior changes, and there are some new additions as well.

To better understand these modifications, we'll take a look at sample projects in Rails 5.1 and Rails 5.2.

Previous behavior

Notice the deprecation warnings we get when calling email_changed?, changed?, changes and previous_changes in Rails 5.1 from within an after_save callback:

2.4.2 :010 > user.em…
All talk but no code... 

Rails' many default_url_options

I have read so many different ways to set default_url_options. But at least in Rails 5.1.4, only some of them worked. The thing is, often one works for console but not for controller, or the opposite happens:

# in development.rb
config.action_controller.default_url_options({:protocol => 'https'})
config.action_controller.default_url_options(:protocol => 'https')
# Does not work

# in development.rb, outside config block
Rails.application.routes.default_url_options[:protocol] = 'https'
# Does not work, but works under console

# in routes.rb
Rails.application.routes.draw do
  default_url_options protocol: :https
# Does not work, but works under console

# in ApplicationController
def…
Greater Than Code 

067: Tech in Transition with Ashanti-Mutinta

Support for this episode of the Greater Than Code podcast comes from the O’Reilly Fluent Conference. Be part of what past attendees call “a great center for modern web development and disruption,” and “the best place to see the current state of the web.” Fluent comes to San Jose June 11 to 14, 2018. Use discount code GTC20 to save 20% on your Gold, Silver or Bronze pass. Learn more at fluentconf.com

Panelists:

Rein Henrichs | Jamey Hampton | Coraline Ada Ehmke

Guest Starring:

Ashanti-Mutinta: @0x424c41434b

Join Our Slack Channel!
Support us via Patreon!

Show Notes:

01:09 – Ashanti’s Superpower: People say they’re funny on Twitter!

02:37 – Having Dialogue and Engaging with Others on…

07:…

Hi, we're Arkency 

Building custom search is hard and boring

Have you ever had to implement a search page for your client? I did and I’ve gotta say it’s often one of the most boring tasks. Not always, but often. There is a big list of features that the client usually expects other similar pages have. Especially when it comes to e-commerce websites. It needs to be fast, it needs to allow filtering, grouping and limiting by various attributes. On the backend side that usually means building sophisticated SQL queries, which is never a fun task when the search is highly dynamic and based on a variety of options available in the UI. Alternatively, you can use ElasticSearch or Lucene/Solr, but I’ve realized that while they are often super fast there is a…

Honeybadger Developer Blog 

Rustic Nil Handling in Ruby

Ad-hoc nil usage causes a lot of problems in Ruby. In this post we explore a more explicit way to handle nil conditions, inspired by Rust.
All Ruby Podcasts by Devchat.tv 

RR 349: The Overnight Failure with Sebastian Sogamoso

Panel: 

Charles Max Wood

Eric Berry

Dave Kimura

David Richards

Special Guests: Sebastian Sogamoso

In this episode of Ruby Rogues, the panel discusses failures with Sebastian Sogamoso. Sebastian is a software developer of 6 years, and working with Ruby for the last 5 years, and before worked with Java and PHP. He is currently living in Panama City, but grew up in Colombia. He now works for CookPad and organizes a Ruby conference in Colombia. Sebastian stresses the fact that everyone fails no matter what, and if you take responsibility and learn from your failures, you can more on to become a better programmer and developer because of it.

In particular, we dive pretty deep on:

  • Ruby,…
Search Results for “ruby” – via @codeship 

How We Built the Codeship API v2

Reading Time: 5 minutes

We started work on our API v2 at the beginning of 2017. We knew that implementing it could have significant implications for our architecture as well as our customers’ workflows, so we wanted to spend the time to get it right rather than rushing to deliver something and then having to live with the consequences.

Click to Tweet:


“Examining how v2 of the Codeship API was brought into being.” via @codeship
Click To Tweet


API Gateway Versus the Majestic Monolith

The first thing we looked at was how it would fit in our current architecture and our vision for the system going forward. Our existing architecture has a couple supporting services surrounded by a Rails…

RubyGuides 

How Are Symbols And Strings Different?

Have you ever wondered about the differences between symbols & strings? Let’s talk about that! Strings are used to work with data. Symbols are identifiers. That’s the main difference. Symbols are not just “frozen strings“, they have different uses than strings. When to Use Symbols One of the most common uses for symbols is to […]

The post How Are Symbols And Strings Different? appeared first on RubyGuides. Don't miss your free gift here :)

Scout ~ The Blog 

Deploying Faktory to AWS Fargate

Looking for a fresh, 2018 approach to deploying a Rails app to AWS? We've partnered with DailyDrip on a series of videos to guide you through the process. We're covering how to Dockerize a Rails app, AWS Fargate, logging, monitoring, setting up load balancing, SSL, CDN, and more.

In today's video, we're setting up a background job server for our Rails app. There are several implementations we can choose from, including delayed_job, resque, and Sidekiq, to name a few.

However, today we'll be using Faktory, which was created by the father of Sidekiq, Mike Perham.

Getting Started

Before we jump into configuring Faktory, let's take a brief moment to talk about its implementation and some…

GoRails Screencasts 

Building A Hosting Platform in Ruby

A talk I recently gave for Remote Ruby explaining some of the approaches I use to build Hatchbox.io
Posts on vaneyckt.io 

Ruby concurrency: building a timeout queue

Ruby’s built-in Queue class is an incredibly handy data structure for all kinds of problems. Its versatility can be attributed to its pop method, which can be used in both a blocking and a non-blocking manner. However, when using a blocking pop, you may not always want to run the risk of this pop potentially blocking indefinitely. Instead, you might wish for your pop to block only until a given timeout interval has expired, after which it’ll throw an exception.
Appfolio Engineering 

Benchmarking Ruby's Heap: malloc, tcmalloc, jemalloc

Last week's post talked about different kinds of Ruby objects: some are contained in the 64-bit reference directly, some use up a 40-byte "Slot", and some use a Slot and a chunk of heap. Let's talk about that last set of objects.

"The Heap" isn't specifically a Ruby concept. It's a standard part of Unix processes. Other than garbage collection, Ruby doesn't do much that's special or unusual with the Heap in its processes. So: what's there to talk about?

It turns out that the heap does get managed. The C standard library has a "normal" malloc. But memory allocation is like everything else run by programmers: you have a bunch of different choices with subtle differences between them. And so you…

Tender Lovemaking 

Speeding up Ruby with Shared Strings

It’s not often I am able to write a patch that not only reduces memory usage, but increases speed as well. Usually I find myself trading memory for speed, so it’s a real treat when I can improve both in one patch. Today I want to talk about the patch I submitted to Ruby in this ticket. It decreases “after boot” memory usage of a Rails application by 4% and speeds up require by about 35%.

When I was writing this patch, I was actually focusing on trying to reduce memory usage. It just happens that reducing memory usage also resulted in faster runtime. So really I wanted to title this post “Reducing Memory Usage in Ruby”, but I already made a post with that title.

Shared String…

Junior Developer 

An RSpec matcher for increment and decrement

I've got some specs that verify a row was removed by expecting Foo.count to be decremented:

expect do
  # some wonderful things
end.to change { Foo.count }.by(-1)

But change ... by(-1) seems a little wordy. This would be more expressive:

expect do
  # some wonderful things
end.to decrement { Foo.count }

And of course we'd want to be able to chain these, and to use increment in place of change ... by(1):

expect do
  # some wonderful things
end.to decrement { Foo.count }
   .and increment { Bar.count }

Update: I had fiddled around and come up with a not-so-great way to do this when Myron Marston pinged me with a much nicer technique using RSpec's alias_matcher API. Thanks Myron!

Drivy Engineering 

Rails 5.1 Change Tracking in Callbacks

After recently upgrading to Rails 5.1, we noticed that certain model changes were no longer getting logged properly by PaperTrail. After a bit of digging, this turned out to be due to a subtle difference in the way that Rails now tracks changes.

It’s a little contrived, but let’s say we have a model that becomes active once info is present, like this:

class Car
  after_save do
    self.state = "active" if info_was.blank? && info.present? && state != "active"
    puts changes # Let's see how changes are tracked
    save!
  end
end

In Rails 5, we get something like:

> car.update!(info: "foo")
{
  "info" => [nil, "foo"],
  "active" => [false, true],
  "updated_at" => [Fri, 19 Jan 2018 15:

However, after upgrading to Rails 5.1,…

Paweł Urbanek - Web and Mobile Developer, Full Stack Blog 

Ruby on Rails Simple Service Objects and Testing in Isolation

Gears represent Rails Service objects

Service Objects are not a silver bullet but they can take you a long way in modeling your Rails app’s domain logic. In this blog post, I will describe how I usually work with service object pattern in a structured way. I will also cover testing in isolation with mocked services layer.

I first read about service objects in a great blog post about 7 Patterns to Refactor Fat ActiveRecord Models. Since then a new article about them pops up every now and then. I decided to add my two cents.

Reasoning behind Service Objects in Rails apps

A service object is a way to encapsulate an app’s logic to prevent fat models and cluttered controllers. It is recommended that they should have only one…

Hi, we're Arkency 

Testing React.js components with Jest in Rails+Webpacker+Webpack environment

Around a month ago, I worked on a task, which required a more dynamic frontend behavior. I worked on a component with 2 selects and 2 date pickers and depending on what was selected where the other pickers or select inputs had to be updated based on some relatively simple business rules. I decided to implement it using React.js and it was fun and pretty straight-forward to finish it. Also, working with http://airbnb.io/react-dates/ turned out to be a very pleasureful experience. But that’s not what this post is about.

I wanted to test my component. The integration between Rails asset pipeline (which you can find in almost all legacy Rails apps) and Webpack (which is what anyone wants to…

Dustin Zeisler 

Custom Ruby Collections with ActiveRecord Like Scopes [Video]

ActiveRecord Scopes can be nice to use and a useful way to think about data. Chaining methods together in logical filters to get the desired results without having to think about the structure of the data. ActiveRecord is tided to doing database queries, but to do that you must have a database. Have you ever wanted use this kind of syntax on a set of custom in-memory objects or an array of hashes? Now let’s not let ActiveRecord have all the fun we can do the same thing in plain old Ruby and I’ll show you how.

Here I’ve got an ActiveRecord Person, notice that it is singular because in ActiveRecord a Class represent a collection of people and a single person. We can’t very well just…

Julia Evans 

Writing performance reviews with positive constructive feedback

Every 6 months at work, I need to write performance reviews for the people I work with (who are all excellent). I find this really hard! Who am I to review how well someone is doing? I’ve only recently started to feel a little more comfortable writing peer feedback, and what’s helped me is to focus on saying things about the person’s work that are both positive and constructive. My goals in writing a performance review are to write something that will be useful for the person to read, and make sure that the higher-ups reading the review understand why that person’s work is important.

It’s very easy to write positive feedback that isn’t useful – “X is so great!” “I love working with X!”…

On the Edge of Ruby 

From an obfuscated Sudoku to Fibers and coroutines

TRICK is the Transcendental Ruby Imbroglio Contest for RubyKaigi, a contest for interesting & weird (transcendental, imbroglio) Ruby programs. I participated in the 2015 edition and won the 4th prize. In this article I explain my submission and detail interesting facts about it.

Not so obfuscated

This is my submission to TRICK 2015. It is actually now part of the ruby/ruby repository, like other winning entries of TRICK.

So what is this? Looks like a Sudoku puzzle in the middle. Running it shows:

1 9 4 2 3 8 7 6 5
3 7 2 6 5 1 4 8 9
8 5 6 7 4 9 2 3 1
7 8 1 3 6 4 5 9 2
4 2 3 9 7 5 8 1 6
5 6 9 8 1 2 3 7 4
6 4 8 1 2 7 9 5 3
9 3 5 4 8 6 1 2 7
2 1 7 5 9 3 6 4 8

1 9 7 2 3 8 4 6 5
3 4 2 6 5…
Jon McCartie 

How Not To Squash Your Team With Red Tape

One of the common tenets of growth theories is that companies require process and structure as they grow. And if they’re lucky, they’ll be around long enough to reach a critical tipping point where too much structure will begin to squash innovation. It’s easy to find examples of companies that have crossed this threshold — they’re slow, bureaucratic, behemoths. How did they get there? At some point in time, someone decided they needed a new process or policy without considering the cost.

I’ve been thinking a lot about this on the Heroku Support team. We’re at a critical point in our evolution where we’re growing fast and trying to keep up. New policies and procedures are probably necessary…

The Bike Shed 

142: What if We Didn't Do Any of This?

Derek and Sean debate the value provided by database migrations written in your programming language of choice versus those written in SQL.

Awesome Ruby Newsletter 

Issue 91 - Happy 6th birthday, Sidekiq. Three new releases!

Ruby Weekly 

#385: How Fast is Ruby 2.5?

Ruby Weekly Issue 385 — February 8, 2018
Noah Gibbs
A new benchmark on the heels of an important performance patch applied after Ruby 2.5.0preview1 shows a nice gain over previous benchmarks.


John Hawthorn
MJIT (which stands for MRI or Method JIT) may form a key part of Ruby 3’s goal to be 3x faster than Ruby 2. An initial version of MJIT has been merged into a fork of the Ruby trunk, leading this author to start running some promising benchmarks.


Sam Saffron
Or “How we instrument Rails at Discourse and how you can, too.”


Sqreen  Sponsored
All Ruby Podcasts by Devchat.tv 

MRS 030: Cameron Dutro

Panel: 

Charles Max Wood

Guest: Cameron Dutro

This week on My Ruby Story, Charles speaks with Cameron Dutro. Cameron is a return guest from Ruby Rogues. Currently, Cameron works at Lumosity, a company that creates brain games & brain training application for web and mobile.  Cameron mention working on the platform team working with internationalization.

Cameron talks about his journey into programming, starting at the age of 4 and being fascinated an IBM 85XT computer and flight simulator games. Cameron describes is early interactions with programming in elementary and high school. Then moving into a professional field after college at Twitter and eventually at Lumosity. Cameron talks…

RubyMine Blog 

Open in Terminal, VCS, and More in the New RubyMine 2018.1 EAP Build

Hi there,

RubyMine 2018.1 EAP2 (build 181.3494.10) is now available. Aside from a number of Ruby-specific bug-fixes for the previous 2017.3 and 2018.1 EAP builds, the new update contains some petty but pretty platform features, as well as some VCS changes that you may want to keep in mind.

Download RubyMine 2018.1 EAP

Let’s get straight to the details:

Open in Terminal

As you can guess by its name, this new option allows you to open dirs and files in the terminal. Select a directory/file in the Project Tool Window and choose the Open in terminal option from the context menu. You can also open files in the terminal using the context menu from the editor, or through Find Action (Help | Find…

Navigate through…

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

European Ruby Conference (EuRuKo) @ Vienna, Austria - Ruby Conferences 'n' Camps Update

Conferences 'n' Camps

What's News? What's Upcoming in 2018?

European Ruby Conference (EuRuKo)
Aug/24+25 (2d) Fri+Sat @ Vienna, Austria • (Updates)

See all Conferences 'n' Camps in 2018 ».

Olivier Lacan 

Migrating Homebrew Postgres to a New Version

This post was originally published as a Gist which I since forgot about and accidentally rediscovered recently when the need arose to resolve a similar accidental upgrade. I felt like it deserved to live somewhere where there is a chance I might update it.

Update (February 7th, 2018)

In Homebrew 1.5 and above, there's a new process to upgrade your Postgres database across major versions using the brew postgresql-upgrade-database command which was recently added by Mike McQuaid.

This is a fantastic one-step improvement over the lengthy guide you'll see below, but since this new command isn't foolproof (it will fail if you haven't killed all processes connected to your database) it…

Greater Than Code 

066: Growing a Culture with Allison Kopf

Panelists:

Sam Livingston-Gray | Jamey Hampton | Coraline Ada Ehmke

Guest Starring:

Allison Kopf: @allisonkopf | Agrilyst

Join Our Slack Channel!
Support us via Patreon!

Show Notes:

01:15 – Allison’s Superpower: Making Unplanned and Hectic Situations Work Out

The Stockdale Paradox

06:43 – Getting Into Agriculture

08:54 – Building a Company Culture

13:19 – Transmitting Culture and Core Values When Hiring New People

20:02 – Disagreeing Respectfully and Maintaining Strong Opinions

25:19 – Clear Boundaries Between Work and Home Life

32:34 – What Tech Look Looks Like in the Context of a Working Farm

40:27 – Writing Code for Non-Technical People

Reflections:

Coraline: Practicing empathy for the…

Julia Evans 

Profiler week 5: Mac support, experiments profiling memory allocations

Hello! Week 5 of profiler work is over. as a reminder – what I’ve been doing is building a new sampling CPU profiler for Ruby! It’s called rbspy and it’s at https://github.com/rbspy/rbspy.

In just-this-second news – someone tweeted at me just now that they used rbspy and it helped them find an unexpected hot spot in their program, which made me super happy!!

The main 2 exciting things that happened last week were:

  • Mac support is done! Supporting Mac is kind of an interesting thing because in my mind rbspy is a production profiler (for figuring out why your production server Ruby code is slow), and Macs are basically all laptops. Nonetheless! Supporting Mac is cool, people are using…
BigBinary Blog 

Ruby 2.5 added Hash#slice method

This blog is part of our Ruby 2.5 series. Ruby 2.5 was recently released.

Ruby 2.4

Let’s say that we have a hash { id: 1, name: 'Ruby 2.5', description: 'BigBinary Blog' } and we want to select key value pairs having keys name and description.

We can use Hash#select method.

irb> blog = { id: 1, name: 'Ruby 2.5', description: 'BigBinary Blog' }
  => {:id=>1, :name=>"Ruby 2.5", :description=>"BigBinary Blog"}

irb> blog.select { |key, value| [:name, :description].include?(key) }
  => {:name=>"Ruby 2.5", :description=>"BigBinary Blog"}

Matzbara Masanao proposed a simple method to take care of this.

Some of the names proposed were choice and pick.

Matz suggested the name slice since…

Test Double | Our Thinking 

Questioning Responsibility

I can imagine paleontologists drooling over our applications' changelogs. I'm sure they wish they had a record of the exact environment that caused a recently uncovered Protoceratops to grow that very interesting third eyeball. They don't know when a helper method was added to give this horn-faced herbivore the ability to see oncoming predators, but unfortunately, made it trip over its feet running away.

We have this power. We can see when the responsibilities of a class grew. We can see how a method changed and a private method was created to hide complexity. We can see how a test was written, mocking that newly created method. We may not have been there when it happened, but seeing that…

All Ruby Podcasts by Devchat.tv 

RR 348: Continuous Automation - Chef, InSpec, and Habitat with Nathen Harvey and Nell Shamrell-Harrington

Panel:

Dave Kimura

Eric Berry

David Richards

Special Guest: Nathen Harvey and Nell Shamrell-Harrington

In this episode, the Ruby Rogues panelist speak with Nathen Harvey and Nell Shamrell-Harrington. Nell is the Senior Software Development Engineer at Chef, the CTO at Operation Code. Nathen is the VP Community at Chef. The topic of discussion is about Chef. Chef is a platform that enables teams to collaborate, share, and automate everything.

In particular, we dive pretty deep on:

  • What is Dev Ops? A cultural and professional movement, focused on how we build and operate high-velocity organizations, born from the experiences of its practitioners.
  • Chef Automate - the platform that…
Appfolio Engineering 

How Fast is Ruby 2.5.0?

Back in November, I posted speed results for Ruby 2.5.0 preview 1. It was barely faster than Ruby 2.4, which was a bit of a disappointment. However, one very important performance patch landed before it finished, which made a big difference in the final speed.

How big? Let's see, shall we?

Quick Graphs

You just want to see the graphs, I'll bet. I'm the same way. Here's a great start: total-time runs for Rails Ruby Bench. This measures the time taken to push a mixture of Discourse (Rails) requests through a big concurrent server:

Yup, those bars on the right are shorter.

Yup, those bars on the right are…

GoRails Screencasts 

How to use Tailwind CSS with Rails

Learn how to use the awesome new Tailwind CSS framework using Webpacker in your Rails app
rossta.net 

Deploying a Vue.js website to Amazon S3 with CircleCI

In this post, we'll walkthrough how I set up continuous deployment for my Vue.js static website. Every time I git push to the primary branch of my repository, an automated process will build the project and upload any new files to Amazon S3 with the appropriate caching headers.

This post is part of an ongoing series on building Connect Four with Vue.js and Phoenix.

Here's an overview of the tools involved:

  • a Github (or similar) account
  • vue-cli
  • an AWS account
  • an S3 bucket set up to host a static website
  • AWS credentials for reading and writing the S3 bucket
  • a CircleCI account
  • a circle.yml configured to build and deploy the site

From…

RubyGems Blog 

2.7.5 Released

RubyGems 2.7.5 includes bug fixes.

To update to the latest RubyGems you can run:

gem update --system

If you need to upgrade or downgrade please follow the how to upgrade/downgrade RubyGems instructions. To install RubyGems by hand see the Download RubyGems page.

Bug fixes:

  • To use bundler-1.16.1 #2121 by SHIBATA Hiroshi.
  • Fixed leaked FDs. Pull request #2127 by Nobuyoshi Nakada.
  • Support option for --destdir with upgrade installer. #2169 by Thibault Jouan.
  • Remove PID from gem index directory. #2155 by SHIBATA Hiroshi.
  • Avoid a #mkdir race condition #2148 by Samuel Giddins.
  • Gem::Util.traverse_parents should not crash on permissions error #2147 by Robert Ulejczyk.
  • Use File.o…

SHA256 Checksums:

  • rubygems-2.7.5.tgz
    38e02c26ef524688dff1a21075297ce0be6543e12c8210ac6c075dc78983c403
  • rubygems-2.7.5.zip
    7babef9df5376a6c1573c1d03ed47a2a21765cde8…
Julia Evans 

Writing eBPF tracing tools in Rust

tl;dr: I made an experimental Rust repository that lets you write BPF tracing tools from Rust! It’s at https://github.com/jvns/rust-bcc or https://crates.io/crates/bcc, and has a couple of hopefully easy to understand examples. It turns out that writing BPF-based tracing tools in Rust is really easy (in some ways easier than doing the same things in Python). In this post I’ll explain why I think this is useful/important.

For a long time I’ve been interested in the BPF compiler collection, a C -> BPF compiler, C library, and Python bindings to make it easy to write tools like:

  • opensnoop (spies on which files are being opened)
  • tcplife (track length of TCP connections)
  • cpudist (count how…

and a lot more. The list of available tools in

Mike Perham 

Happy 6th Birthday, Sidekiq

Six years ago I shipped Sidekiq v0.5.0 and changed my life. I talked to some developers recently:

"I had been working in Go for a while but I kept coming back to Ruby because Sidekiq makes everything so fast and easy to scale."

This is my recipe for success. Sell a product developers want because it makes their job so much easier. You don't need a sales force when developers evangelize your product to every new company they join.

Notes to self 

Conditional unique indexes in Rails and PostgreSQL

This is a simple example of adding a conditional and partial unique index to Rails applications backed by PostgreSQL.

To demonstrate adding a conditional unique index I will use a following User model that I want to add:

class User < ApplicationRecord
  belongs_to :project

  enum role: %w(team_leader designer programmer)
end

Users in this case belongs to a project and function in one of the three possible roles. However to make our project team perform better we want to allow only one team leader on the team.

To build such unique index we can use simple SQL query:

CREATE UNIQUE INDEX unique_user_role_in_project ON users (project_id, role) WHERE role = 0;

It’s a composed index on proje…

Paweł Urbanek - Web and Mobile Developer, Full Stack Blog 

Optimize Rails Performance with Redis Caching and Rack Middleware

Fast car symbolizing Ruby on Rails performance and speed

According to (a bit exaggerated) Pareto principle, 5% of your Rails app endpoints could account for 95% of performance issues. In this blog post I will describe how I improved a performance of my Rails application’s bottleneck endpoint by over 500% using a simple Redis caching technique and a custom Rack middleware.

Results of Rails app performance optimization benchmarks Over 500% performance improvement

Benchmarks were conducted using Siege on a 2015 Mac Book Pro with 16GB RAM and 2,2 GHz Intel Core i7. I’ve executed them against Rails app running locally in a production mode with a copy of a production database using Puma server with 2 workers, 16 threads each. I’ve used the following Siege settings:

siege --time=60s --concurrent=20

Rea…

Drifting Ruby Screencasts 

Ruby on Rails - Tips and Tricks

In this episode, we will go through some of the tips and tricks that we often take for granted. We will be looking at nested routes, scopes, migrations and more.
blog of Marian Posăceanu - rubyist most of the time 

Tomorrow is the first day of How to web 2010, this should be fun

Just got in Bucharest, tomorrow I’ll be at How to Web 2010 . Hope it’s going to be good, the presentations look juicy.

I hope I’ll meet some inspiring people and hopefully something to burst some new ideas or perspectives about the web. All in all, its not such a simple subject like: "oh, so you do web stuff ? isn’t that nice", the whole area is getting more and more complex by the day.

That’s not a bad thing of course, the problem is coping with all that change coming in small bits at high speed. Let’s look at this problem from a programmers perspective, firstly we have the basic stuff, algorithms, patterns, good problem solving skills, testing and all that, but new technologies emerge…

blog of Marian Posăceanu - rubyist most of the time 

Keep your Rails logs free of unwanted noise

I like to use Rollbar 's default plan for small apps or prototypes that are wip. Getting production exceptions in my inbox can be quite useful but most of them are actually 404s - sure there are a multitude of ways for filtering out the noise (Fail2Ban , hand written IPTables rules , etc.)

The main idea here is to filter as much of the Rails's logs noise with simple enough changes — security is a completely different topic (though some of the tools do touch on that realm too).

nginx

First thing I've observed was that my app was getting scanned via the IP and not the domain name — so first the fix comes as a configuration change in nginx to enable responses only via the app's host:

server…
blog of Marian Posăceanu - rubyist most of the time 

JRuby, RVM and Vim walk into a (performance) bar

I'm not sure why RVM is still my default Ruby version manager yet the issue at hand should be reproducible on rbenv too.

Let's add a bit of context to this: we have an API written in Ruby and running on JRuby i.e. via JVM which implies slow start-up times compared to CRuby (yes, even with export JRUBY_OPTS='--dev'). I use Vim 8.0.502 which of course comes by default bundled with Tim Pope's vim-ruby .

The problem: since I've switched to JRuby I started to notice a slowdown whilst working in Vim with .rb files. I did not pay too much attention to it at first (read almost for a month) but today it really started to bug me. I had no idea what was causing the slowdown so I tried Vim's trusty…

blog of Marian Posăceanu - rubyist most of the time 

The perils of writing request specs using concurrent-ruby under the JVM

When I write an API, though I'm not a hard core TDD practitioner, I do like writing specs - especially requests specs that test the whole stack.

Adding them into an API is fast and yields quite good results compared to an app with an UI where you have to use chrome-cli or phantomjs just to get near of that level but at the cost of painfully slow execution time (yes, even if you optimise them to hell and back and get a runtime of five minutes - they're still slow in my book).

Anyhow, for some context - I've been writing Ruby APIs for quite some time but using the classic CRuby VM/interpreter - this time we switched to JRuby (thanks to Max ) since we needed to render extremely quick JSON…

Riding Rails 

Rails 5.2.0 and 5.1.5 release candidates, marshaling performance and more!

Hey there, news attenuated people of planet Rails! It’s your trusty prudent editor / local dimwit Kasper here with This Week in Rails. As always we both cover and cower at the highlight reel of Rails’ past week.

Lets slow our roll a bit to pursue what’s meaningful not merely what’s expedient!

Help test Rails 5.2.0.rc1 and 5.1.5.rc1

This week came the release candidate of the next Rails release. Bundle it, run your tests, boot a server — maybe even try it a bit in production. That’ll really help ensure 5.2.0 is solid gold.

If you’re not 5.2 ready yet, Rails 5.1.5.rc1 is also ready to test.

This Week’s Contributors

29 contributors crossed the tangled weave of the web this week to get…

Andy Croll 

Enumerable avoids using temporary variables when looping

Some of my favourite Ruby features are to be found in the Enumerable module. You can read more about it in the Ruby documentation.

A class representing a collection, such as Array, Set or Hash, has the methods and features of Enumerable included. These methods allow you to loop through the members of that group and take an action using each member of the collection as an input.

Instead of…

…using a C-style loop with a temporary variable, which would be fine in many other languages.

total = 0
[1, 3, 5, 7].each do |num|
  total += num
end
total

Use…

…your deep love of one of Ruby’s Enumerable methods, and implement using #inject.

[1, 3, 5, 7].inject(0) do |total, number|
  total += nu…

Or better…

…there’s a…

Ruby – Dog Snog dot Blog 

A Docker dev config for Ruby on Rails

I use Docker for all my client work, and most of my personal projects too. I love it. It’s saved me a ton of money because it uses so much less RAM than Vagrant — what I had been using.

Benefits of this config

  • Just docker-compose up to set up and launch the dev environment (Yep, a one-liner like vagrant up – that’s the goal.)
  • One easy-to-install dependency to get coding on a new computer: Docker. (Versus two complex ones when using Vagrant.)
  • A true development-oriented config: Source code is mounted so that changes in the container appear on the host, and vice-versa.
  • Fast re-builds because the DOCKERFILE is written to help Docker cache the images.
  • Syncing with the Postgres startup delay.
  • A…

Now the three files, followed by instructions and my comments. Or jump right to the GitHub Repo.

How to Dockerize a Rails app

  1. Copy the three config files to the root folder of an existing Rails project. Make run.sh executable, e.g. chmod +x run.sh.
  2. Edit your development database settings to connect to Postgres at host db, username postgres, password is an empty string.
  3. Spin it up with docker-compose up.

Your Rails…

OmbuLabs Blog 

Upgrade Rails from 4.1 to 4.2

This article is part of our Upgrade Rails series. To see more of them, click here.

This article will cover the most important aspects that you need to know to get your Ruby on Rails application from version 4.1 to 4.2.

  1. Ruby version
  2. Gems
  3. Config files (config/)
  4. Application code
    1. ActiveRecord
    2. ActionMailer
  5. Miscellaneous
  6. Next steps

1. Ruby version

Rails 4.2 requires Ruby 1.9.3 or later, and Ruby 2.0 (or newer) is preferred according to the official upgrade guide.

2. Gems

If you're using RSpec 2, you'll need to migrate to RSpec 3, since RSpec 2 doesn't officially support Rails 4.2. To make this process easier, you can update to RSpec 2.99, which will print a bunch of deprecation…

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

RubyKaigi @ Sendai, Miyagi, Japan - Ruby Conferences 'n' Camps Update

Conferences 'n' Camps

What's News? What's Upcoming in 2018?

RubyKaigi CFP closes Feb/28 2018
May/31-Jun/2 (3d) Thu-Sat @ Sendai, Miyagi, Japan • (Updates)

See all Conferences 'n' Camps in 2018 ».

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

wroc_love.rb @ Wrocław, Poland - Ruby Conferences 'n' Camps Update

Conferences 'n' Camps

What's News? What's Upcoming in 2018?

wroc_love.rb CFP closes Jan/31 2018
Mar/16-18 (3d) Fri-Sun @ Wrocław, Poland • (Updates)

See all Conferences 'n' Camps in 2018 ».

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

RubyConf Belarus @ Minsk, Belarus - Ruby Conferences 'n' Camps Update

Conferences 'n' Camps

What's News? What's Upcoming in 2018?

RubyConf Belarus
Apr/21 (1d) Sat @ Minsk, Belarus • (Updates)

See all Conferences 'n' Camps in 2018 ».

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

Ruby Unconf Hamburg @ Hamburg, Germany - Ruby Conferences 'n' Camps Update

Conferences 'n' Camps

What's News? What's Upcoming in 2018?

Ruby Unconf Hamburg
May/5+6 (2d) Sat+Sun @ Hamburg, Germany • (Updates)

See all Conferences 'n' Camps in 2018 ».

Engine Yard Blog 

Ruby SSL Error: certificate verify failed

When working on your Rails app or when installing gems, you might get this Ruby SSL error :

zverok with ruby 

You should not implement #to_a for your classes

Well, occasional reader of this blog is no stranger to strong statements, so here is one more of them.

For a short preface, lets reiterate about one useful Ruby idiom: Kernel#Array method, a.k.a. “I don’t care; it should be an Array!”

If at some point of working with data you have a method that could’ve received, or returned, both singular value and array of values, and at next point you need to remove this distinction, and have definitely an array, you can do that:

Array(1) # => [1]
Array('test') # => ["test"]
Array([1, 2, 3]) # => [1, 2, 3]  -- nothing changed, it is already an array
Array(nil) # => []  -- well... make sense

That’s one of the small brilliant pieces of…

Appfolio Engineering 

CRuby Memory Slots: See Them, Tweak Them, Make Them Fast

You've probably read a lot about how Ruby handles memory over the years. If you haven't: there's a lot. Ruby is a dynamic language, and managing memory in dynamic languages is complicated. Managing memory well and fast in dynamic languages is usually very complicated. For instance, here's a very simple summary of how garbage collection works in Java. It's similar -- and complex.

Mostly you don't have to care. Most Java developers don't know that whole summary and most Ruby developers understand only a small fraction of how Ruby memory management works. Yay! If you had to know all that to write a program, it would be terrible.

You care about the specifics of how Ruby manages memory if you're…

Sam Saffron 

Instrumenting Rails with Prometheus

How we instrument Rails at Discourse and how you can, too.


People following me have occasionally seen me post graphs like this:

Usually people leave this type of instrumentation and graphing to NewRelic and Skylight. However, at our scale we find it extremely beneficial to have instrumentation, graphing and monitoring local cause we are in the business of hosting, this is a central part of our job.

Over the past few years Prometheus has emerged as one of the leading options for gathering metrics and alerting. However, sadly, people using Rails have had a very hard time extracting metrics.

Issue #9 on the official prometheus client for Ruby has been open 3 years…

Awesome Ruby Newsletter 

Issue 90 - What's new in Rails 5.2: Active Storage and beyond. A hands-on guide.

Riding Rails 

Rails 5.1.5.rc1 has been released!

Hi everyone,

I am happy to announce that Rails 5.1.5.rc1 has been released.

If no regressions are found, expect the final release on Tuesday, February 6, 2018. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 5.1.4

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

Ruby Conferences 'n' Camps in 2018 - What's Upcoming? 

What’s Up in 2018/2? - Ruby Conferences ‘n’ Camps in February 2018 from Around the World

Conferences & Camps

February

Thu 1
Rubyfuza Registration is open CFP is open
Feb/1-3 (3d) Thu-Sat @ Cape Town, South Africa • (Updates)
Fri 9
RubyConf India CFP closes Dec/15 2017
Feb/9+10 (2d) …
Scout ~ The Blog 

Scout &lt;&gt; Rollbar Integration: unifying your stability metrics 🚀

When things are going wrong, the more signals you can view from one screen, the better. Today, we're excited to announce an integration with Rollbar. This brings Rollbar's best-of-breed error monitoring into Scout's performance-focused UI, creating a single source for your stability metrics:

rollbar scout

We display active Rollbar items alongside Scout's performance insights on both your app dashboard and on respective web endpoint and background job screens. We've made it easy to distinguish between new and recurring items: when a new item appears, the item count is filled with an orange background and we indicate the new item with a special annotation.

Setup the Rollbar integration in your app…

Test Double | Our Thinking 

The Consultant's Code

I wish we could have built it right the first time but we were learning along the way.

Ugh, we got handed this mess and now we have to figure out what to do with it.

What do you think we should do?

Sound familiar? If any of these statements resonates with you then you've most likely been in the shoes of the person making the statement or as a consultant engaged with a client in a similar predicament. The phrase "Software Consulting" generally evokes feelings of praise or disdain, or perhaps both depending on the circumstances. As consultants, we are often positioned as experts and typically engaged during times of crisis or uncertainty; so it should come as no surprise that our ability to…

Ruby Weekly 

#384: Rails 5.2 RC1, Passenger 5.2, and yield_self goodies

Ruby Weekly Issue 384 — February 1, 2018
David Heinemeier Hansson
The beta period is over and we’re headed for final release with Rails 5.2 introducing Active Storage, the Redis Cache Store, HTTP/2 Early Hints, and more.


Evil Martians
Not just interested in the news of the release (above)? This post covers much more including Active Storage, credentials, the Current singleton, CSP configuration, and Bootsnap.


Phusion
Features a major refactoring of configuration option handling which now supports per application options. Ruby 2.5…
Ruby – Sihui Huang 

Ouch! That Code Hurts My Brain.

Notes for my talk in rubyfuza 2018, Africa’s premier ruby conference. (Click here for the video.)

Welcome to this talk: Ouch! That code hurts my brain.

Raise your hands if the following scenario sounds familiar to you.

After a day of work, you feel exhausted and have a headache.

You get back home feeling so tired that you don’t want to say a single word.

You close your eyes and feel the pain inside of your head.

Anyone?

This talk is about how to turn code from brain-hurting to brain-friendly.

I’m Sihui.

I work at a startup called

I blog at sihui.io. I share lessons learned at work and things related to software design.

This talk contains three parts. First, why some code tires us…

All Ruby Podcasts by Devchat.tv 

MRS 029: Sudhindra Rao

Panel: 

Charles Max Wood

Guest: Sudhindra Rao

This week on My Ruby Story, Charles speaks with Sudhindra Rao, Sudhindra has been a Ruby developer for over 10 years. Sudhindra talks about working on media platforms, e-commerce type sights, campaign platforms, and healthcare applications. Sudhindra talks about working in Ruby still but has moved into many platforms and technologies.

Sudhindra talks about his journey into programming, starting with electrical engineering, control systems, and has a Masters degree in Control System, switch interest him into learning more about how the software is created and functioning. Sudhindra talks about learning more about operating systems and digging…