Comparison to UJS

Before we start comparing, let’s start with why.

Why mrujs?

Mrujs is intended to provide an easier upgrade path from Rails 6 to Rails 7 by continuing to use the UJS API already present in UJS enabled apps while being an up-to-date library that works well with Turbolinks or Turbo.

In addition, mrujs is compatible with more than just Rails, we can use it with other Ruby frameworks like Hanami, Roda, Sinatra, etc. and even outside of the Ruby sphere!

Mrujs is also the spiritual successor to rails-ujs which is the successor to jquery-ujs. Mrujs is just doing its part to continue the chain of succession.

What is the same?

We worked hard to make sure mrujs is as “drop-in” as possible for 95% of the use-cases of UJS.

Popular use-cases include:

What is new?

What is incompatible with mrujs?

Why is .js.erb deprecated?

For a multitude of reasons.

Rails 5.2+ requires a change in the content-security policy in relation to running arbitrary javascript through script tags which means .js.erb is not supported.

.js.erb is a security concern, and also requires a lot of nonce code generation and checks to work properly.

Generally injecting javascript from the server into the DOM is frowned upon. I cannot in good conscious support this method of writing views.

Feel free to read more by DHH here: