How to remove/disable the automatic XSS protection helper html escaping for Rails 3

How to remove/disable the automatic XSS protection helper html escaping for Rails 3.

This is probably a horrible idea.

Extracting the conditions of a named scope in Rails 2.3

See attached link for a way to extract the conditions of a named scope in Rails 2.3.

Get Your App Ready for Rails 4

Let’s take a look at what you need to do to get your app ready for Rails 4.

Asset pipeline for Rails 2

The asset pipeline from Rails 3.1 packported to 2.3. By Michael Grosser from parallel_tests fame.

Using ENUMs with Rails - See John Code

This sounds promising:

The best part from the Rails side, is that you don’t have to change anything at all in your code to swap a varchar out for an ENUM.

Three quick Rails console tips

How to call routes, make requests and try out helpers from the Rails console.

Locale: Localisation for Rails developers

A possible way for localisation in Rails applications that allows editing translations remotely.

Configuration for Rails, the Right Way

I still see people promoting various gems and plugins to handle miscellaneous configuration elements for your application. One little known secret is that Rails 3 allows you to define your own configuration elements trivially.

Making the rails 3.1. asset pipeline and asset precompiling work in production mode

Recently, we had an interesting lunch-break with the rails 3.1. asset-pipeline in production mode. Daniel Zahn made a blogpost about our journey, precompiling assets, fingerprinting, Haml, Sass & Compass and what he calls "the dark heinous hutch".

Why developers should be force-fed state machines

Most web applications contain several examples of state machines, including accounts and subscriptions, invoices, orders, blog posts, and many more. The problem is that you might not necessarily think of them as state machines while designing your application. Therefore, it is good to have some indicators to recognize them early on. The easiest way is to look at your data model.

Matching elements on complex web pages with Webrat

XPath matchers can be combined with CSS-selector matchers. This is really useful if not, for example, the content of an element should be matched but the element itself like in the following example. Here a form is used to display data as default value in its input elements. This can be the case in web applications in which data should be edited easily without additional clicks.

Rails: Disabling logging entirely

In an environment:

config.logger = Logger.new('/dev/null')

JSONP for Rails

The rack-contrib gem brings a JSONP middleware that just works™. Whenever a JSON request has a callback parameter, it will wrap the application's JSON response appropriately.

The project is a bit dated, but the JSONP middleware is ok.

rack-mini-profiler - the Secret Weapon of Ruby and Rails Speed

rack-mini-profiler is a powerful Swiss army knife for Rack app performance. Measure SQL queries, memory allocation and CPU time.

This should probably not be loaded in production (the article recommends otherwise), but this looks like a useful tool.

6 front-end techniques for Rails developers. Part I: From big ball of mud to separated concerns

Amazing guide how to divide a ball of Javascript spaghetti distinct separate layers (model, view, controller, backend adapter).

It does not use a Javascript framework.

Mute Rails asset pipeline log messages

quiet_assets helps with disabling asset pipeline log messages in the development log. When the gem is added, asset pipeline logs are suppressed by default.

If you want to disable muting temporarily, add config.quiet_assets = false to your config/application.rb.

PDF Generation in Rails

A look at Prawn, PDFKit, and Wicked PDF

What's new in edge Rails: Active Record enums

Declare an enum attribute where the values map to integers in the database, but can be queried by name.

Obfuscating data in Rails applications for screenshots and demonstrations

I recently had a need to demonstrate a data-heavy application to potential customers. Demonstrating the application with bogus numbers is one thing, but everything looks much more realistic when I’m using real data. I can’t reveal any real information, though, so I needed a quick way to obfuscate real names. Faker to the rescue!

query_diet now support Rails 3

Installation differs slightly from older versions, please check the README.

Rails, callbacks, workers, and the race you never expected to lose « Logical Friday

How delayed jobs can make your after_save callbacks execute before the record is saved.

Updated: Test a gem in multiple versions of Rails

Updated the card with our current best practice (shared app code and specs via symlinks).

Ruby, Ruby on Rails, and _why: The disappearance of one of the world’s most beloved computer programmers

Nice article to educate your non-geek girlfriend/boyfriend about the joys of programming.