Firefox 5.0.1, which we were using for most Rails 2.3 projects, does not run on Ubuntu 14.04 any more. Here is how to update affected projects. Update (or create) .firefox...

...run tests with Geordi, it will tell you how to install it. On a Rails 2 project: Update your Cucumber-related gems as described in Upgrading Cucumber and Capybara, including...

github.com

When you need to use diff in either some Ruby code or your Rails app, use the differ gem. puts Differ.diff "foo", "boo" # => {"boo" >> "foo"} Usage There are several variants...

The following code activates autoloading using ActiveSupport 3.x: require 'active_support' require 'active_support/dependencies' relative_load_paths = %w[app/controllers...

guides.rubyonrails.org

When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly...

...builds/webpack-resolver -- failed pretty hard for Webpack 2. The following works for Ruby on Rails with Webpacker / Webpack 2. Do not use the ace-builds NPM package, because you won...

github.com

...performance due to the cost of reindexing. Minidusen is currently compatible with MySQL, PostgreSQL, Rails 3.2, Rails 4.2 and Rails 5.0. Basic Usage Our example will be a simple address...

...for cronjobs, the "craken" plugin, is no longer maintained and does not work on Rails 3.2+. We will instead use the whenever gem. "Whenever" works just like "craken", by putting...

Rails supports alert and notice as default flash types. This allows you to use these keys as options in e.g. redirect_to and as a helper in views e.g. <%= notice...

When you put a Rake task into lib/tasks, but running it fails with... Don't know how to build task...

...has enabled the only_full_group_by setting by default to prevent this. In Rails this could lead to some trouble, because scopes do not have specific select columns in...

There are different ways to run rake: On Rails 4.1+ projects, you have Spring and its binstubs which dramatically improve boot-up time for Rake and similar. You need to...

rake is a function rake () ... Next, try running rake routes on a Rails 4.1+ project -- the 2nd time should be significantly faster. On older projects you should always...

If you have a FooController and also have a layout app/views/layouts/foo.html, Rails will use this without being told so. This is super convenient except never...

edgeguides.rubyonrails.org

Rails guide that covers PostgreSQL-specific column types and usages for Active Record. You should especially keep in mind the special datatypes that PostgreSQL offers. \ Types like json and array...

...param is a string and you don't get the magic type casting that Rails would give you if it was an actual database column. E.g. when you set an...

Rails' url_for is useful for generating routes from a Hash, but can lead to an open redirect vulnerability. Your application's generated route methods with a _url suffix are...

...Open Redirect vulnerability. It's as simple as passing a host=evil.tld URL parameter. Rails would see url_for(..., host: "evil.tld") and happily generate a URL to that foreign host...

Provide a stable API for working with scopes across multiple versions of Rails, since Rails has a tradition of breaking details of its scope API every other release...

.../../../../../../../../../etc/passwd%%0000.html) Someone tries to exploit CVE-2019-5418. If you use the latest Rails (or latest Rails LTS) you're safe. The exact versions that fix this issue are...

...Rails 6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2, 4.2.11.1, Rails LTS 3.2.22.13 and Rails LTS...

I got this error when running Rails 2.3 tests for Rails LTS. More stacktrace: NoMethodError: undefined method `cache' for Gem:Module /vagrant/rails-2-3-lts-repository/railties/lib/rails_generator/lookup.rb:212:in `each' /vagrant/rails-2-3-lts-repository/railties/lib/rails_generator/lookup.rb:146:in `to_a...

makandra dev

...Prepare Sunspot on your development machine What you want in your Gemfile: gem 'sunspot_rails' gem 'sunspot_solr' gem 'progress_bar' # for sunspot:solr:reindex Now define what should be...

...troublesome upgrade to 1.9.3 and go straight to 2.1. When trying to make a Rails app run on Ruby 1.9, you're likely to encounter several issues. Here are a...

Resque comes with its own dashboard (Resque server) that you can mount inside your Rails 3 application with #config/routes.rb: require 'resque/server' My::Application.routes.draw do # ... mount Resque::Server => '/resque' end

...e 'create database IF NOT EXISTS minidusen_test;'" failed and exited with 1 during . Rails 2/3 migrations don't work anymore bundle exec rspec spec -- create_table(:users) bundler: failed...

You will get this when you are using the latest version of Rails with a recent version of Rack: SECURITY WARNING: No secret option provided to Rack::Session::Cookie.

...future versions will even invalidate your existing user cookies. The warning is caused by Rails calling Rack incorrectly. It is unclear when this is going to be fixed in Rails...

api.rubyonrails.org

...ActiveRecord::Rollback, read on. The basic problem Not all databases support nested transactions. Therefore, Rails will sometimes silently ignore a nested transaction and simply reuse the other transaction. However, a...

...cause a roll back! To avoid this unexpected behaviour, you have to explicitly tell rails for each transaction to indeed use proper nesting: ActiveRecord::Base.transaction(joinable: false, requires_new: true...