Ruby on Rails 5.0.5RC2 out now

Second release candidate of 5.0.x version of Ruby on Rails framework is out now
27 July 2017   656
Ruby on Rails

Framework written in the Ruby programming language

Good news for RoR developers. New 5.0.5 release candidate 2nd version has been released.

Changelogs

Changelist for every gem:

  • Railities
    • Regression fix: Allow bin/rails test to take absolute paths to tests.

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.0.5.rc2.gem
dfcbee8aca863312a170b1075d9a740cfaf60c68d9a4351e23d2783dd63450a1  actioncable-5.0.5.rc2.gem
c2f6615b14485b4c7b5a9b37712087cd90af5fd3ad0fec470ff3c08660dcfce2  actionmailer-5.0.5.rc2.gem
650abc83a3e475169ae8c52b366bb73f358533b0611f53bec102ff3676a94855  actionpack-5.0.5.rc2.gem
fd83b598a5e1a76d379f373bd6788e238517f01a1589e99295f5fa67be9e24b0  actionview-5.0.5.rc2.gem
0ec63149a7f9d8316e37337a151700d34db07b6cf3b326548e54370db2a15779  activejob-5.0.5.rc2.gem
31a3248f20cd0c8c466e68c50bace354dad56033412d6404c2cfd27aad892bac  activemodel-5.0.5.rc2.gem
c558ce4d2011a5729d647cc83d19878745a4d1472a2b526f8ba1b54efd4eda98  activerecord-5.0.5.rc2.gem
73d8d516919c22d27f4d16a241cf7e41ddd152c23d2a6317a62e032ae064b36d  activesupport-5.0.5.rc2.gem
35792281ba2c7af605f2b17453856dd6ee64649d94545e8501ec91db111a6451  rails-5.0.5.rc2.gem
46111198cde865ba3512a828342fe35810671661fbc58b3f8ae5c749e1372239  railties-5.0.5.rc2.gem

 

DateTime, Timestamp, Time and Date in Rails

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

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.