Ruby on Rails 5.1.3 RC2 released

New released candidate for Rails 5.1.3 available now
27 July 2017   747

Fine news for RoR coders. New 5.1.3 release candidate 2nd version has been released.

Changelogs

List of changes for every gem:

  • Railities
    • Regression fix: Allow bin/rails test to take absolute paths to tests. (same for 5.0.5RC2)

As always, you can view whole list of changes at GitHub. 

If no regressions will be found, final release expected on Monday, 24th of July, 2017. Developers ask everyone who will face any issues, to open a GitHub issue and mention @kaspth in order to developers fix it as soon as possible. 

SHA-256

Feel free to use this checksum in order to check version of your gem

$ shasum -a 256 *-5.1.3.rc2.gem
f2a510b5f274e7cdb9f18dbab316fe1fa703ba91af5e031fe807355633728b3b  actioncable-5.1.3.rc2.gem
303c71c3f8d792f07523fb7bb3afb366dd46293fdccfccaf8491f2db00dc93aa  actionmailer-5.1.3.rc2.gem
d86ac0ffd0dc12cde3ce332b8e4be53b16a8b7b3591c76c75657d114fa26a6fb  actionpack-5.1.3.rc2.gem
f6666a49474da4261c0bc00e9301e46075fe2c6453cf96033f5f3fa05397ceb5  actionview-5.1.3.rc2.gem
61d969886d73f1bf16a06c268dabdc890cc68c7c67c531743e81573e3f3acadd  activejob-5.1.3.rc2.gem
051f8d9fe6811bc8c3be0fc4630db8c740f5d57e3f3a605ca43e02a4790559f8  activemodel-5.1.3.rc2.gem
9e5671a03f0f6f7c3d1eea4c3320e2ae2c9e614add1d2c086e6ee3efcff56cda  activerecord-5.1.3.rc2.gem
7f953d0e72f934fc6c7b1a2dfd4f2e2c96910b3891c550a8fed682ee8c303722  activesupport-5.1.3.rc2.gem
d7ea7b6ee2ad1881f44bec83af5183dad6a52fed6ba7d25430bdab5f2394d067  rails-5.1.3.rc2.gem
2a95a264a470d65b6aa109ddbfcc451f6cd7c1235cbde9c458c19168773d432d  railties-5.1.3.rc2.gem

 

DateTime, Timestamp, Time and Date in Rails

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

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.