...require to require_relative where I loaded RSpec factories in Cucumber's env.rb (the Rails application root is no longer in the load path by default) replacing the old debugger...

...to your Gemfile. iconv is a part of Ruby that was removed in 2.0. Rails 3 seems to depend on it. All the pain with magic # encoding: utf-8 comments...

makandra dev

You don't need a Rails application to use Sass. Even when you're working on a static site you can generate your CSS through Sass. Install Sass with sudo...

...gitignore to not exclude public/stylesheets/*.css, since stylesheets aren't being generated automatically without Rails (this would bite you after a deploy). Instead exclude .sass-cache, which will be created...

Run bundle update cucumber capybara cucumber-rails to update to the newest versions. Backup your features/support/path.rb to be able to add your own paths again after the cucumber installation script...

...your features/support/env.rb file to be able to reintegrate parts like your blueprints setup: ENV["RAILS_ENV"] ||= "cucumber" require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') require 'spec/support/blueprints' Run $ rails generate cucumber:install...

...images, this slows down development response times. You can fix that by defining a Rails route like this: if Rails.env.development? scope format: true, constraints: { format: /jpg|png|gif/ } do

...root path: xsendfile: unable to find file: /tmp/foo20110721-28050-1h104da-0 The reason for this is that Rails 3 uses X-Sendfile for file downloads and Apache is only allowed to transfer files...

makandra dev

Last week saw a security issue with rails 2.3 that required a fix. While an official patch was provided, the 2.3 branch is no longer maintained. So we forked it...

...but they are not very easily discoverable.) To use our fork, change the gem "rails"... line in your Gemfile to this: gem 'rails', :git => 'https://github.com/makandra/rails.git', :branch...

Ever wondered how Rails talks to itself in a Cucumber feature? In Rails 3 you can do it like this: def rack_env(path) { "rack.input" => {}, "PATH_INFO"=>"#{path}", "REQUEST_METHOD...

end request = rack_env('/users/new') response = Rails.application.call(request) status, headers, body = response puts status # e.g. 200 puts headers.inspect # hash of headers puts body.body # html of response body

Under certain (unknown) circumstances, Rails will give localized files an invalid content-type in the Response header. For me, after requesting corporate_information and rendering corporate_information.de.html.haml, Rails sent a content...

...topic that offer workarounds, but none solved it for me. The issue occurred with Rails...

You either have an old version of Mocha and an edge version of Rails 3.2, or you have a new version of Mocha and an old version of Rails. The...

...best solution is to update Mocha to the latest version and switch to Rails edge. If you are using shoulda-matchers or another gem that locks Mocha to an old...

...installing Bundler 1.1 you will get the following warning when running tests: WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called...

...To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile The warning is misleading because it has nothing to do with moving cucumber-rails into...

github.com

...is a MongoDB adapter for Ruby. We've forked it so it works for Rails 2.3.x applications running on Ruby 1.9. [1] makandra/mongomapper is based on the "official" rails2...

...it, add this to your Gemfile: gem 'mongo_mapper', :git => 'git://github.com/makandra/mongomapper.git', :branch => 'rails2' [1] The last version to be compatible with Rails 2 was 0.8.6: While there are...

weblog.rubyonrails.org

Rails 4.0 is finally ready after a thorough process of betas and release candidates. It's an amazing new version packed with new goodies and farewells to old features past...

rails-erd.rubyforge.org

Gem to generate entity relationship diagrams from your Rails 3 ActiveRecord models. The diagram style is pretty and configurable...

blog.plataformatec.com.br

This means Basecamp migrated from the first Rails release up to the edge one. So how come people say so frequently how hard is to update their applications from Rails...

...to Rails 2.2? And the answer is simple: plugins...

...led me to the solution: I had to write has_many placeholder.to_sym. When Rails can't find an association, make sure it's defined as symbol Seemingly, that's...

...a bug in Rails...

The ActionMailer in Rails 2 depends on a buggy version of TMail, which sometimes inserts a blank line into the mail header when sending a mail to multiple recipients. This...

...mail through an MTA like Exim, it will fix this for you. Fix for Rails if you don't have an awesome MTA TMail is no longer maintained. The bug...

makandra dev

Have you ever mistaken one Rails environment for another? The attached helper will help you to never do it again. Save the attached file to app/helpers/ and use the widget...

...in your layout like this: %body = rails_env_widget unless Rails.env.production? It'll render a small light gray box in the top left corner of your screen, containing the current...

There are a few ways to access view helpers from the Rails console. The easiest way is the helper shortcut: helper.translate 'i18n.string' helper.your_helper_method If the desired helper renders...

...a view template, you need this setup: view_paths = Rails::Application::Configuration.new(Rails.root).paths["app/views"] av_helper = ActionView::Base.new(view_paths).extend YourHelperModule av_helper.your_helper_method

This will show you how to create a RSS feed that the Feed Validator considers valid. Note that RSS is...

blog.plataformatec.com.br

It is common in Rails 3.0 applications that you want to provide default views for a group of controllers. Let’s say you have a bunch of controllers inside the...

...for Admin::PostsController and “app/views/admin/posts/index.html.*” is not available, it should then render “app/views/admin/defaults/index.html”. Since Rails 3.0, we have a new abstraction called resolvers that holds the logic to find a...

markembling.info

Using uncountable resources is not recommended as it breaks Rails' magic, e.g. when using form_for. You'll always be better off using simple pluralizable resources. Rails automatically creates path...

...will refer to the show action: /sheep/:id. Solution As the linked article states, Rails creates a special _index_path for this scenario. Thus, you can simply call:

...fix this issue. This patch is planned to be included in the next makandra Rails LTS release...

When writing Rails migrations to convert a string column to an integer you'd usually say: change_column :table_name, :column_name, :integer However, PostgreSQL will complain: PG::DatatypeMismatch: ERROR...

...it has always worked: NoMethodError: undefined method `allow_value' for # This is due to Rails 4.1 (specifically, Spring) revealing a weak point of shoulda-matchers -- jonleighton explains why. Solution