Notes posted by taryneast

RSS feed
January 17, 2019 - (v4.2.7)
0 thanks

This method has been completely removed from Rails 5 onwards

Completely removed from Rails from 5 onwards. See issue: github.com/rails/rails/issues/18336

Just remove from your codebase, or protect with `private` keyword

June 15, 2011
1 thank
March 22, 2011
0 thanks

Find a random *set* of records (without killing the db)

If you want to find any number of records without sorting your entire table randomly every time, try the solution I posted here:

http://rubyglasses.blogspot.com/2010/05/activerecord-find-in-random-order.html

March 16, 2011 - (<= v2.3.8)
0 thanks
January 24, 2011
0 thanks

you probably want:

Rails.env

or possibly:

ActionController::TestRequest.new (which has a demo of how to set env vars on a controller test)

December 9, 2010 - (<= v2.3.8)
0 thanks

Gotcha: index name must be a string, not a symbol

Using rails 2.3.8 I kept getting an exception when i tried:

add_index :widgets, [:colour, :weight], :name => :index_by_colour_weight

it’s solved by using:

add_index :widgets, [:colour, :weight], :name => 'index_by_colour_weight'
November 14, 2010 - (v1.0.0 - v2.3.8)
0 thanks

In Rails 3 you can find it here

In Rails 3 - this validation is moved to the HelperMethods

August 24, 2010
0 thanks

Deprecated

Instead of using:

session.delete

Now use:

reset_session
May 7, 2009
0 thanks

question?

Shouldn’t the second example be:

[1,2].zip(a,b)         #=> [[1, 4, 7], [2, 5, 8], [nil,6,9]]

??? or am I missing something?

April 16, 2009
0 thanks

Known unknowns

In case it isn’t obvious - this is what you use when you’re fleshing out all the tests that you haven’t written yet. eg if you have a set of twenty tests for a complex piece of functionality, and just want to write out the “should” declarations (or equivalent), so you don’t forget all the corner cases… then fill out the tests themselves. Putting an assert_fail makes sure you notice if you forget to come back and fill in the body of a test.

March 27, 2009
2 thanks

Deprecated - replacement method

The description rightly lists this as deprecated, but using it will still work atm, as it seems to have moved to ActiveSupport::CoreExtensions::Module instead.

So your code should still work.