Its all about Ruby On Rails
Posts tagged edge rails
Edge Rails: Time#current
Jul 5th
Returns Time.zone.now when config.time_zone is set, otherwise just returns Time.now
Edge Rails: Array#random_element
May 24th
Array#rand is deprecated in favor of Array#random_element and will be removed in Rails 3.
As per the comment added to the commit:
Array#rand is deprecated because it masks Kernel#rand within the Array class itself, which may be used by a 3rd party library extending Array in turn. See https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4555
Edge Rails Updates
May 14th
New edge rails deprecations:
Time#last_year is deprecated in favor of Time#prev_year
Time#last_month is deprecated in favor of Time#prev_month
Date#last_year is deprecated in favor of Date#prev_year
Date#last_month is deprecated in favor of Date#prev_month
New methods/aliases:
Date#sunday: Returns a new Date representing the end of this week
Time#sunday: Returns a new Time representing the end of this week
rename_index: Rename database index
Ex: rename_index :people, ‘index_people_on_last_name’, ‘index_users_on_last_name’
Feel free to add more as comments..
Edge rails: ActiveRecord::Base.each and ActiveRecord::Base.find_in_batches for batch processing
Feb 23rd
You guys must faced a situation when you need to process large number of records, for example sending newsletters. Then you must have done some sort of batch processing to save it eating up all of your memory. This feature is committed to rails core by DHH.
Now you can do something like User.each and User.find_in_batches.
Please refer here for more details.
Edge Rails: Now define your plugin’s routes in plugin’s config/routes.rb
Nov 28th
If you wrote/writing a rails plugin that need to have an entry in rails routing, you need not to ask your plugin users to make that entry in RAILS_ROOT/config/routes.rb manually any more. In the latest version of rails you can add your custum routes in your plugin config/routes.rb file. Rails will automatically load those routes.