Background - cucumber - GitHub

Background allows you to add some context to the scenarios in a single feature. A Background is much like a scenario containing a number of steps. The difference is when it is run. The background is run before each of your scenarios but after any of your Before Hooks.

tbuser's acts_as_pradipta at master - GitHub

What Pradipta Archiputra (aka "MAX ARCHIE") uses to send his recruitment emails. This plugin pretends that CC and BCC

Railscasts - Embedded Association

Learn how to set up a one-to-many or many-to-many association which is entirely embedded into a single column through a string or bitmask.

sinsiliux's Blueprints at master - GitHub

Another replacement for factories and fixtures that focuses on being DRY and making developers type as little as possible.

acunote's template_inliner at master - GitHub

Template inliner avoids the problem when to render a large list of objects,

cwninja's inaction_mailer at master - GitHub

An ActionMailer delivery method to save mails as files in a directory.

cwninja's popthis at master - GitHub

So you downloaded inaction_mailer, and you had a folder full of e-mails generated while writing your app?

elevation's event_calendar at master - GitHub

Easily show multiple, overlapping events across calendar days and rows.

pjdavis's identity-map at master - GitHub

A simple implementation of an Identity Mapper for Active Record.

How to split a Ruby class into multiple source files - Gem Session

Unfortunately vanilla Ruby modules lack support for many idioms popular in modern Ruby. Most importantly, we have become accustomed to composing our classes with meta-programming macros such as has_many, validates_presence_of or after_save. And modules weren't built with macros in mind.

cavalle's steak at master - GitHub

Steak is like Cucumber but in plain Ruby.

datagraph's rack-throttle at master - GitHub

Rack middleware for rate-limiting incoming HTTP requests.

jnicklas's carrierwave at master - GitHub

File upload solution that supports form roundtrips when a validation fails.

Handy! RGB to HSL and RGB to HSV color model conversion algorithms in JavaScript - Axon Flux // A Ruby on Rails Blog

Here is a set of additive color model conversion algorithms that I found published on Wikipedia and have implemented in JavaScript.

Sailing down the Hudson with RVM - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS

We recently decided our CI server needed an overhaul. I really enjoyed Integrity as a build server, but after trying out Hudson it’s hard to say I want to go back. Hudson has several huge advantages.

Ultimate rspec matcher to test named_scope or scoped - Web development blog

What do we expect from the custom finder? We expect that it should find assets A, B, C and should not find assets D, E, F. And sometimes the order is important: it should find A, B C with exact order.

Insertion/Deletion callbacks

All ActiveRecord associations except for has_many :through support callbacks for pre- and post-insertion/deletion via the following, self-documenting parameters:

Make your Rails console (and irb) output better readable

Pour color on your Rails console with awesome_print. Turn confusing long strings into formatted output. Have objects and classes laid out clearly whenever you need it.

Put gem 'awesome_print', :group => :development into your Gemfile. Now on the Rails console you have the command ap that will give you a colored, formatted output of whatever you pass it. See the example output of the User class below.

For customization visit the repository on Github.

![awesome_print.png](https://makan...

Rails Asset Pipeline: Building an Icon Font from SVG Files

Webpacker can automatically create an icon font from SVG files, which is really handy. When you're using the asset pipeline, you can still have an icon font from SVG files, but it requires some manual work.

Creating the icon font

  • Install the NPM package icon-font-generator. If you're not using nvm, run sudo npm install -g icon-font-generator
  • Put all SVG icons for the font into their own directory.
    • The icon name will be taken from the SVG file name
  • Download the attached script and update the Configure...

Structuring Rails applications: the Modular Monorepo Monolith

Root Insurance runs their application as a monolithic Rails application – but they've modularized it inside its repository. Here is their approach in summary:

Strategy

  • Keep all code in a single repository (monorepo)
  • Have a Rails Engine for each logical component instead of writing a single big Rails Application
  • Build database-independent components as gems
  • Thus: gems/ and engines/ directories instead of app/
  • Define a dependency graph of components. It should have few edges.
  • Gems and Engines can be extracted easier once nece...

Rails: Have different session secrets for all environments

The Rails secret_token must be unique for each application and any instance of it. If not, someone could exploit this by creating a user with ID = 1 (e.g. on staging), sign in and then use that cookie to authenticate on another site (e.g. on production, where the user with ID = 1 probably is the admin).

Here is a one-for-all solution that does not affect current production users, leaving the production token unchanged: prefix the existing secret_token with #{Rails.env unless Rails.env.production?}.

Note: There may be tokens in ...

Automatically validating dependency licenses with License Finder

"Open-source software (OSS) is great. Anyone can use virtually any open-source code in their projects."

Well, it depends. Licenses can make things difficult, especially when you are developing closed-source software. Since some OSS licenses even require the employing application to be open-sourced as well (looking at you, GPL), you cannot use such software in a closed-source project.

To be sure on this, we have developed a project-level integration of Pivotal's excellent [license_finder](https:/...