Notes posted by taryneast
RSS feedThis 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
Was removed to a plugin in v 2.0
Is now the auto_complete plugin here:
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
you probably want:
or possibly:
ActionController::TestRequest.new (which has a demo of how to set env vars on a controller test)
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'
In Rails 3 you can find it here
In Rails 3 - this validation is moved to the HelperMethods
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.
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.