Tag: ruby
-
Filtering by Association Count in Complex Models in Rails
I recently tried to optimize a slow page, and bumped into some limitations in the way Rails works with complex associations.
-
Rails "Disable-able" button component
Here’s a simple ViewComponent/Stimulus controller for a disable-able button; that is, a button that you can programmatically disable/enable. You could use this to prevent form submission until all fields are valid.
-
Building an LTI DeepLinking Response in Rails
LTI DeepLinking is an LTI standard which enabled passing content from your LTI Tool back to the LMS. This allows, for example, an RCE editor button placement that will launch your tool and return rich content to be embedded in the editor.
-
Using Ruby Structs to Model API Responses
Here’s a technique I use when I want to wrap an API response in a simple class, rather than use a raw hash result. It allows easier access to the object properties, and allows you to attach some instance methods, with a minimal amount of boilerplate.
-
Handling LTI Launches in Rails
This article explains how to set up your Rails application as an LTI Tool Provider, to handle LTI 1.3 launches from an LMS, including the OCID workflow, user authentication and what to do with the information you get from the LMS.
-
Parameterized Modules in Ruby
Reading the documentation for some dry-rb projects, like dry-auto_inject, I was intrigued by the syntax in examples like this: