If you would like to use language specific layout (e.g. background-images) in your applications stylesheets you can achieve this...
...load associated records if you know you need to access them later on. The Rails docs say: Eager loading is supported with polymorphic associations. This is true, but has some...
...and include their current versions' primary media... Page.includes(:current_version => :primary_medium).to_a ... Rails will produce 4 queries: Page Load (0.7ms) SELECT "pages".* FROM "pages" PageVersion Load...
...your working directory that you cannot remove by either checkout, reset [--hard], stash, probably Rails' Spring is the culprit and not Bundler itself. Fix spring stop The author of the...
For some reason you want to define a find condition in array form. And in that condition both column name...
gem 'super_diff' Require it in your spec_helper.rb require 'super_diff/rspec' # For Rails applications you can replace this with 'super_diff/rspec-rails' Customize colors in spec/support/super_diff.rb SuperDiff.configure do |config...
...contain exactly "XXX" ActiveRecord::Base is monkey patched by super_diff/rspec-rails (includes rspec and rails) super_diff/rails (includes active_record and active_support) super_diff/active_record This means that you have...
Recent rails security updates have shown that people make incorrect assumptions about the possible contents of the params hash. Just don't make any! Treat it as what it is...
.../pages/edit?foo --> params == {:foo => nil} /pages/edit?foo[] --> params == {:foo => [nil]} # at least in older rails 3 and in rails 2.x Be especially wary about stuff like User.find_by_password...
...at the same time have a .where on an included table, two things happen: Rails tries to load all involved records in a huge single query spanning multiple database tables...
activity.users.ids # here happens the unexpected # => [4] Workarounds Preload separately In newer Rails versions you should prefer to use joins and then preload if necessary (which will trigger a...
...for old IEs. Unfortunately, their auto-loading mechanism may not work properly on your Rails application due to the asset pipeline. They use FileAPI, so you could just include it...
Note that when your app is a web app, the console running your rails server will pause the server and show the debugging console. Your browser will "hang" while...
If you need to debug code that is part of a gem like rails, just (temporarily) add a puts or debugger statement to its source files. Ruby is an...
Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass a hash to where, it goes through Arel eventually. Rails...
The asset pipeline is one of Rails' two mechanisms how stylesheets, javascripts and images from your /assets folder are processed and delivered to the browser. Rails has a second pipeline...
...webpacker, which we will cover later. Learn Read Everything You Should Know About the Rails Asset Pipeline Read How to make your application assets cachable in Rails Read Managing vendor...
If you have an integer and want to use it to represent an element's position (like "1st" for 1...
When you try to remove a non-existing index using remove_index, the migration will incorrectly pass without an error...
...to be released when the block ends. Example: RSpec::Mocks.with_temporary_scope do allow(Rails).to receive(:env).and_return('production'.inquiry) puts Rails.env # prints "production" end puts Rails.env # prints...
Shortener is a Rails Engine Gem that makes it easy to create and interpret shortened URLs on your own domain from within your Rails application. Once installed Shortener will generate...
If you turn on stylesheet caching, it might happen that stylesheets from different locations with different relative pathes will be...
If you parse this Yaml ... yes: 'Totally' no: 'Nope' ... you get this Ruby hash: { true: 'Totally', false: 'Nope' }
...identity map for ActiveRecord. Ruby 1.8.x support will be dropped with or after Rails...
There is a problem with AJAX response handling for Rails 3 remote links and forms in Internet Explorer. This problem affects applications still using jQuery...
SSL in Rails 3 is non-obvious...
This gem is designed to provide CSS views to Rails, and a process to concatenate and minify these files to one file for production...
...post explains, in some detail, how we will implement a nice performance boost for Rails developers. Understanding the details might help gain the full benefits of the optimization, but you...
...walk you through the I18n API and contains a tutorial how to internationalize a Rails application from the start...
YAML List of all translations currently available in Rails