What is the difference between Rails 4, Rails 5 and Rails 6?

There are various rails versions available. And every versions has some upgrades and removals. So it's good to know some difference between suc versions. Mainly rails 4, 5, and 6. Knowing this difference mainly help you when you are 3-4 years experienced developer and had worked on multiple rails versions. And answering this may create a good impression for you, because one can think about you that you are not only good at work but you also keep yourself updated with the framework changes.

Look below to know the difference between all rails 4, 5 and rails 6 versions.

Rails 4

1. Rails 4 uses the gems like paperclip, carrierwave, shrine to support file upload

2. No Actioncable exist till rails 4

3. Till rails 4 one can only create APIs in a complete rails app, no support for api only applications

4. In Rails 4, all model classes inherited from ActiveRecord::Base. No ApplicationRecord was there

5. Rails 4 uses the webrick as the server

6. Rails 4 uses jquery_ujs

7. Supports secrets.yml to store environment/secret variables

8. ActiveJobs were not available till rails 4.1 and supported in rails 4.2

9. rake is used to perform any task till rails 4.x. For example to run the migrations, you need to run rake db:migrate

Rails 5

1. Rails 5.2 introduces ActiveStorage to upload files

2. Rails 5 introduces ActionCable support realtime communication

3. Rails 5 introduces API only applications to be created

4. Rails 5 introduces ApplicationRecord Model. All other models inherited from ApplicationRecord model and it is inherited from ActiveRecord::Base

5. Rails 5 uses the puma server

6. Rails 5 uses rails_ujs

7. By default uses sprockets to manage the asset pipeline, webpacker needs additional settings to be used

8. Till rails 5.1 it supports secrets.yml to store environment/secret variables but since rails 5.2 it supports credentials.yml.enc to store the environment vars and needs a master.key to encrypt it. This allows to store credentils for different environments like development, staging, production

9. All rails versions >= 5.x supports the ActiveJob

10. rake has been replaced by rails since rails 5. For example to run the migrations, now you need to run rails db:migrate

Rails 6

1. Supports ActiveStorage

2. Support ActionCable

3. Support API only applications

4. Has ApplicationRecord model

5. Uses puma server

6. By default uses webpacker to serve the javascript, sprockets needs additional settings to be used

7. It supports credentials to store environment.secret variables just like rails 5.2 for different environments

8. All rails versions after 5 supports ActiveJobs

APPSIMPACT Academy

Ruby on Rails is a very popular and most productive web application development framework. At APPSIMPACT Academy we provide best content to learn Ruby on Rails framework.

Questions & Answers
What is the difference between instance variables and local variables? What is initialize() method in Ruby? What are getter and setter methods in Ruby? Comparision between rails 4, 5 and 6 What is difference between sub and gsub in Ruby? How to recreate flatten method in Ruby using recursion?