Ruby on Rails 5.0.5RC1 released

New release candidate of 5.0.x version of Ruby on Rails framework is out now
21 July 2017   1354
Ruby on Rails

Framework written in the Ruby programming language

Good news for RoR fans. New 5.0.5 release candidate 1 version has been released.

Changelogs

List of changes for every gem:

  • Action Pack
    • Fallback ActionController::Parameters#to_s to Hash#to_s.
  • Active Record
    • Relation#joins is no longer affected by the target model's current_scope, with the exception of unscoped.
  • Railities
    • Make Rails' test runner work better with minitest plugins.
      By demoting the Rails test runner to just another minitest plugin — and thereby not eager loading it — we can co-exist much better with other minitest plugins such as pride and minitest-focus.

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.rc1.gem
71ae996b0cbadc4836d8de61058870fe3d7ae275c5a3d345b851ca8b88e7c5a7  actioncable-5.0.5.rc1.gem
58fe87b9daf4dc1ddc89110e83846c0e0939fc97c8463e789785d28eddd34ee1  actionmailer-5.0.5.rc1.gem
123d468dcb3e523d1fb82367ebec2d630c6b625d1ad3d1b635bfc718c5d94624  actionpack-5.0.5.rc1.gem
117d39ee700e82903a3f0c3c242e986326acd08e7bab1059fd0afc6e58a2d19c  actionview-5.0.5.rc1.gem
99c51db0728e139a7833af9785323c967cbd474b3f9f1d20f5802628c33398f4  activejob-5.0.5.rc1.gem
9f81997461c252608451c61f5121754fb8aa36f30a1f9f6167a77826cae76be1  activemodel-5.0.5.rc1.gem
9cef200cd17925cd22055d6c5b2d2f22514f434f98983bcba0484e472f208211  activerecord-5.0.5.rc1.gem
ca8be3d1ee126f0e0b84cb9c932771cd718a524c60f2a63dccd32c33831aff74  activesupport-5.0.5.rc1.gem
0fd92b43895a1a73d639b93eec67159bed1003ce2a3f6250030b05091ae40046  rails-5.0.5.rc1.gem
3516bc7c5d3337fe5134ac0a7ec60337078817b569a56381a4f3fe737ef04546  railties-5.0.5.rc1.gem

 

DateTime, Timestamp, Time and Date in Rails

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

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.