Starting from Rails 4.0, you can use a special form options helper called #collection_check_boxes. It behaves similar to...
When using threads, you must make your code thread-safe. This can be done by either locking (mutexes) all data...
You know that ActiveRecord caches associations so they are not loaded twice for the same object. You also know that...
Now supports RSpec 3 and Rails 4 Drops support for state_machine, which has some issues with Rails 4 and...
It's generally not trivial to change a datetime's seconds, minutes, etc in SQL. Here is how it works...
Today I learned that Ruby on Rails has shipped with a built-in slug generator since Rails 2.2:
Web applications can be used by multiple users at the same time. A typical application server like Passenger has multiple...
RSpec 3 has verifying doubles. This breed of mock objects check that any methods being stubbed are present on an...
If you need to log to a file you can use Ruby's Logger class: require 'logger'
If you're on Ruby 2.3+ there's a <<~ operator to automatically unindent HEREDOCs: str = <<~MESSAGE Hello Universe!
See this Railscast. Basically you can simply write views like index.xlsx.erb: ID Name Release Date Price <% @products.each do |product| %> <%= product.id...
To achieve this goal you have to setup the session store like the following example: MyApp::Application.config.session_store( :cookie_store...
Postgres 9.4 introduces a new column type: jsonb. json and jsonb columns store data differently, so just compare the two...
When you are using the #selector_for helper in Cucumber steps, as e.g. Spreewald does, the following snippet will save...
When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly...
If you want to load an SQL dump from an ActiveRecord migration, you might find this to be harder than...
I've pushed an update to Cucumber factory that simplifies working with FactoryGirl factories. Say you define a factory with...
Using uncountable resources is not recommended as it breaks Rails' magic, e.g. when using form_for. You'll always be...
Geordi 1.0 features a command line application geordi, that holds most of Geordi's previous commands. New features
Add gem 'database_cleaner' to your Gemfile. Then: Cucumber & Rails 3+ # features/support/database_cleaner.rb DatabaseCleaner.clean_with(:deletion) # clean once, now DatabaseCleaner.strategy = :transaction...
Jonas Nicklas, the author of Carrierwave and Capybara, has released Refile, a gem for handling file uploads in Rails. It...
Run bundle update cucumber capybara cucumber-rails to update to the newest versions. Backup your features/support/path.rb to be able to...
Capybara-screenshot can automatically save screenshots and the HTML for failed Capybara tests in Cucumber, RSpec or Minitest. Requires Capybara...
Rails includes a way to see what an e-mail will look like. Integration to RSpec All you need to...