This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# put this file at .rubocop/cop/naming/short_variable_name.rb | |
# then ensure you have the following in .rubocop.yml: | |
# | |
# require: | |
# - .rubocop/cop/naming/short_variable_name.rb | |
# | |
# Naming/ShortVariableName: | |
# Enabled: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from '@hotwired/stimulus' | |
/* | |
Disable a button when it is clicked | |
Ps: Rails 7.0 has dropped UJS, so `data-disable-with` is no longer available | |
Example usage: | |
= button_to 'Confirm', foo_path, method: :post, class: "btn btn-warning", data: {controller: 'disable-with', 'disable-with-content-value' => 'Confirming...'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module QueryTrackable | |
extend ActiveSupport::Concern | |
# | |
# Prints the number of queries and the time spent in milliseconds | |
# Useful to track the performance of isolated classes | |
# | |
# Usage: | |
# | |
# class MyClass |
OlderNewer