Rails 5.0.4.rc1 released

New Rails version release
15 June 2017   1128

 Good news for all Rails coders. Rails 5.0.4.rc1 has been released.

Ruby

A dynamic, open source programming language, focused on simplicity and productivity

If no issues will be found, final release is planned on Monday, June 19, 2017. If you will find any bugs, developers ask you to open an issue on GitHub and mention one of the creators (@rafaelfranca).

Ruby on Rails

Ruby on Rails (RoR) - a framework written in the Ruby programming language

Changes lists

Here is a list of changelogs for each gem:

  • Active Model:
    fix regression in numericality validator when comparing Decimal and Float input values with more scale than the schema by Bradley Priest.
  • Active Record:
    1. Restored previous behavior of collection proxies: their values can have methods stubbed, and they respect extension modules applied by a default scope by Ryuta Kamizono.
    2. Loading model schema from database is now thread-safe. Fixes #28589. By Vikrant Chaudhary, David Abdemoulae.

Other gems, such as Action Cable, Action Mailer, Action Pack, Action View, Active Job, Active Model, Active Record, Active Support and Railties had not received any updates.

Full listing of changes available at GitHub commits.

SHA-256

Use this SHA-256 hashes in order to verify the version of your gem.

$ shasum -a 256 *-5.0.4.rc1.gem
c99354a6392225b29f01f2c0c73d27cd641a247298871640eeee032d1e6d9f58  actioncable-5.0.4.rc1.gem
07698e6e34e4d4c848cf6b13ea5555c7fa7904c8b6bc2583c9675e19ba91fda8  actionmailer-5.0.4.rc1.gem
828705ee694b5818ec06f05405223ce2f396aa23156e1084a02f0fac9ded2d9d  actionpack-5.0.4.rc1.gem
c8f07e7f26dd86467be877e17f637b76770ee571dd858e037995754ae38dbcd7  actionview-5.0.4.rc1.gem
6cf499ce3625be2f9ef8d998885651cee88335767311b6652bca3f1c271161a9  activejob-5.0.4.rc1.gem
147ec420d4e88fec7b10edb2efb404c563b0551230fc5e930f5c9fe627520c81  activemodel-5.0.4.rc1.gem
bc8f9aa699f31e5642a14afc3566f6744ad93ac80454306cba986ad530923c08  activerecord-5.0.4.rc1.gem
95fa2d6d89dec776faabc2878eb6334884455ff6836daaceaf2e7de3f3f07c64  activesupport-5.0.4.rc1.gem
44843943d4fc377d589bbead59fb74b5bb82e2ab9d1c160fe8884cac6bc17c17  rails-5.0.4.rc1.gem
95785e5e333e2db554e10e733069db1a3cd0d3137f63ec180491082c8b8afa71  railties-5.0.4.rc1.gem

This small update will help to make Rails more safe and stable. Not big, current update.
 

Dmitry Karpunin
Chief Front-End Developer at Evrone

DateTime, Timestamp, Time and Date in Rails

Learn about key differenece between DateTime, Timestamp, Time and Date in Rails
31 October 2017   613

The difference between different date/time formats in ActiveRecord have little to do with Rails and everything to do with whatever database you're using.

Using MySQL as an example (if for no other reason because it's most popular), you have DATEDATETIMETIME and TIMESTAMP column data types; just as you have CHARVARCHARFLOATand INTEGER.

So, main differences: DATE only stores a date, TIME only stores a time of day, while DATETIME stores both.

The difference between DATETIME and TIMESTAMP is a bit more subtle: DATETIME is formatted as YYYY-MM-DD HH:MM:SS. Valid ranges go from the year 1000 to the year 9999 and everything in between. While TIMESTAMP looks similar when you fetch it from the database, it's really a just a front for a unix timestamp. Its valid range goes from 1970 to 2038. The difference here, aside from the various built-in functions within the database engine, is storage space. Because DATETIMEstores every digit in the year, month day, hour, minute and second, it uses up a total of 8 bytes. As TIMESTAMP only stores the number of seconds since 1970-01-01, it uses 4 bytes.

You can read more about the differences between time formats in MySQL here.

In the end, it comes down to what you need your date/time column to do. Do you need to store dates and times before 1970 or after 2038? Use DATETIME. Do you need to worry about database size and you're within that timerange? Use TIMESTAMP. Do you only need to store a date? Use DATE. Do you only need to store a time? Use TIME.

Having said all of this, Rails actually makes some of these decisions for you. Both :timestamp and :datetime will default to DATETIME, while :date and :time corresponds to DATE and TIME, respectively.