New Rails book "Demystifying Rails" released

New Rails book will suit for experienced developers
23 June 2017   1043
Ruby

A dynamic, open source programming language with a focus on simplicity and productivity.
 

Ruby on Rails

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

Launch School, popular online learning portal, recently released new book called "Demystifying Rails".

Demystifying Rails
Demystifying Rails

Book was under construction for a year. It is written for experienced web coders who want not just to get familiar with Rails, but to understand how all this stuff works together. As someone can suggest, this is not a newbie tutorial, but a solid materiel for skilled developers. Book is a part of a 301 course at Launch School.

It's a journey "under the hood" of RoR framework to see how web application development process looks like without Rails. It will help to understand why frameworks and especially Rails exists. Reader will see how it is to create web application without a framework. This book is written to show the developers how the "life" is without Rails.

Also, you can have more info about another Ruby on Rail tutorials.

Book is free and can be read here at LaunchSchool

DateTime, Timestamp, Time and Date in Rails

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

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.