Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Normally, JavaScript must be involved to interactively build the Baseball Card, but thanks to Opal, we can write most of the code in pure Ruby instead. Note that some Opal Native code was mixed in as well (that is using ticks to execute small bits of JS inside the [Ruby](https://www.ruby-lang.org/) code just like when you use ticks in CRuby to shell out into the command line terminal), thus demoing this Opal capability too.
Next, let's refactor the code to utilize Opal jQuery in Ruby instead of plain Opal. This simplifies the code in app/assets/javascript/application.js.rb quite a bit:
Opal enables writing web front-end code in Ruby, thus producing highly maintainable, productive, and understandable code on both the client-side and server-side.
Next, let's build a complete Rails application using Opal Ruby instead of JavaScript, called Baseball Cards!