The “New Rails 6” gem has been out for quite a while now and is one of the more modern framework choices. When we first looked at this gem, we had some doubts that it was going to be the new Ruby on Rails (ROR) replacement. However, we soon saw that this gem has quite a few new features that are both new and exciting. In this article, we will take a look at the six new features in particular:

– Active Record Mapping: This new feature makes it easy for your Active Record users to map directly to the database. You no longer have to worry about Active Record being a “magic” framework that creates complicated queries and complex associations. With this gem, all you need to do is to map one user record to another. The code is kept small and your application becomes flexible and testable.

– Default values and context methods: When you set default values in your controller, they will be passed along to every view in the form. And when you create a context method, it will automatically be added to every view. You don’t have to worry about writing large DSL code or worrying about errors. Both of these things are taken care of by the framework itself. This saves you a lot of time.

– Implicit actions: You no longer have to write “on perform” actions. If an action needs to be performed, it will be automatically called and run by the code. Rails 6 has literally thousands of different actions and scopes that you can use.

– Form Builder: You can easily create forms with just a few clicks of your mouse. It’s built into the Rails Engine so you don’t need to learn any new tricks. There are also many advanced layouts you can create with a layout builder.

Active Record helpers: You don’t have to know any of the Rails code to use all the new Active Record helpers. They are included with the server, so there’s really no need to understand how they work. In fact, most of the helpers use the same syntax as the ones of Active record. The only difference is that they work in database instead of on the view.

Hashable Forms: You no longer have to manually edit the HTML of forms because they are now passable. You just need to remember the name of the form and you can instantly change its HTML. So, if you want to change the form’s HTML and place a submit button, just remember the name of the form, input it in Rails and you’re done.

ailable Hashes: When you make a URL from a URL, you usually include the protocol and the hostname. But in Rails, you can omit both of them and pass an empty string. This will make the URL easily readable for browsers. As for the content of the URL, you can omit the scheme name and the hostname and the value will be treated as an HTML tag instead of a URL.

constants declaration: Rails treats all the files of a project with the same conventions. All the constants and methods of a class are accessed the same way no matter how many they contain. And so, whenever you declare a constant or a method, you also create a local scope, which means it will only be visible within the blocks named by those keywords.

– Argument namespaced names: As I already mentioned, named arguments allow you to create more descriptive names for your functions. In earlier versions of Rails, the method names were all lowercase. This was a big mistake. Now you can nest multiple arguments on one line. And if you don’t want to use one keyword for a multi-arity argument, you can prepend a colon to prevent conflict.

constants everywhere: There’s no longer a need to italicize keywords that are used in constants. The language will handle this for you. Instead, use curly braces around the word. If you’re still confused about how things work, consult the official Rails documentation or look at the source code. Things will become clearer after you start using them.

– Mixins: You might have noticed that in earlier versions of Rails, a single action block could have many associated actions. With the introduction of mixins, however, you can separate these entities into their own modules. This way, you don’t need to repeat your code for each entity. You just write one action and then include it into your series of actions. Your code will only reference the necessary ones.