apidock.com

All columns of a model's database table are automagically available through accessors on the Active Record object.

Rails has generic error messages you can define in your locale .yml files. You may override those application-wide error...

blog.codeclimate.com

Rails’ reputation as a relatively secure Web framework is well deserved. Out-of-the-box, there is protection against many...

nt.ntnu.no

yaml4r is a juxtaposition of yaml documents and their Ruby couterpart. Thus, it does a great job as YAML-doc...

Sometimes you might want to limit the number of associated records in a has_many association, but cannot add a...

view_context.helper_method('args') Rails 2 ApplicationController.helpers.helper_method('args') Also see How to use helper methods inside a model...

The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...

When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...

Unfortunately, Capybara does not offer a switch to disable cookies in your test browser. However, you can work around that...

stackoverflow.com

Access the Method object Dead simple: Get the method object and ask for its owner: "foo".method(:upcase) # => #

Rails flashes (FlashHash) track a list of used keys, which is not respected when comparing flash hashes.

Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background

Ruby 1.8 (supplied by Rails' ActiveSupport) >> BigDecimal.new("0.1").floor.class => BigDecimal Ruby 1.9 (supplied by Ruby 1.9 itself) >> BigDecimal.new("0.1").floor.class...

ariejan.net

Rails understands a :limit options when you create columns in a migration. Its meaning depends on the column type, and...

robots.thoughtbot.com

Guide how to make fixes in other people's GitHub repositories. It's basically "Open Source Development 101".

web.archive.org

TL;DR: You should generally use #size to count associated records. size Counts already loaded elements If the association is...

tl;dr: Do not use merge! for session hashes. Use update instead. Outline Let's assume you're modifying the...

Watch out when saying something like 1.year in Rails. The result is not a Fixnum and can cause unexpected errors...

github.com

MongoMapper is a MongoDB adapter for Ruby. We've forked it so it works for Rails 2.3.x applications running...

makandracards.com

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

gist.github.com

Rails 2.3.16+ on Ruby 1.9 causes warnings like this: .../gems/activesupport-2.3.17/lib/active_support/core_ext/string/output_safety.rb:22: warning: regexp match /.../n against to UTF-8 string...

makandra dev

JavaScripts and CSS should be minified for production use. In Rails 3.1+ the asset pipeline will take care of this...

If you need to capture signatures on an IPad or similar device, you can use Thomas J Bradley's excellent...

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