### Run Solid Errors Rails Installer Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Executes the Solid Errors generator to set up necessary files, including `db/errors_schema.rb`, for database integration. ```bash rails generate solid_errors:install ``` -------------------------------- ### Ruby: Configure Solid Errors for Separate Primary/Replica Database Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This example demonstrates configuring `config.solid_errors.connects_to` to utilize a separate primary/replica database pair for Solid Errors. This setup is suitable for applications requiring read/write separation for their error logs. ```ruby # Use a separate primary/replica pair for Solid Errors config.solid_errors.connects_to = { database: { writing: :solid_errors_primary, reading: :solid_errors_replica } } ``` -------------------------------- ### Run Solid Errors Database Migration Source: https://github.com/fractaledmind/solid_errors/blob/main/UPGRADE.md Executes the pending database migrations for the specified errors database, applying the schema changes defined in the `UpgradeSolidErrors` migration. ```bash rails db:migrate:{name_of_errors_database} ``` -------------------------------- ### Install Solid Errors Gem Manually Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Installs the Solid Errors gem globally or into your Ruby environment if Bundler is not used for dependency management. ```bash gem install solid_errors ``` -------------------------------- ### Install Solid Errors Gem with Bundler Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Adds the Solid Errors gem to your application's Gemfile using Bundler, managing dependencies automatically. ```bash bundle add solid_errors ``` -------------------------------- ### Generate Solid Errors Upgrade Migration Source: https://github.com/fractaledmind/solid_errors/blob/main/UPGRADE.md Generates a new Rails migration file for the specified errors database, preparing for schema changes required by Solid Errors 0.4.0. ```bash rails generate migration UpgradeSolidErrors --database {name_of_errors_database} ``` -------------------------------- ### Solid Errors Development and Release Commands Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This snippet provides a series of bash commands for setting up the Solid Errors development environment, running tests, interacting with the console, migrating the database, installing the gem locally, and releasing new versions to RubyGems. ```bash bin/setup rake test bin/console rake db:migrate bundle exec rake install bundle exec rake release ``` -------------------------------- ### Generate Migration for Non-Nullable Fingerprint Source: https://github.com/fractaledmind/solid_errors/blob/main/UPGRADE.md Generates a new Rails migration file to mark the `fingerprint` column in the `solid_errors` table as non-nullable, ensuring data integrity after all existing errors have been fingerprinted. ```bash rails generate migration SolidErrorFingerprintNonNullable --database {name_of_errors_database} ``` -------------------------------- ### Define Solid Errors Fingerprint Non-Nullable Migration Source: https://github.com/fractaledmind/solid_errors/blob/main/UPGRADE.md Defines the `change` method for the `SolidErrorFingerprintNonNullable` migration, setting the `fingerprint` column in the `solid_errors` table to be non-nullable. ```ruby class SolidErrorFingerprintNonNullable < ActiveRecord::Migration[7.1] def change change_column_null :solid_errors, :fingerprint, false end } ``` -------------------------------- ### Fingerprint Existing Solid Errors Data Source: https://github.com/fractaledmind/solid_errors/blob/main/UPGRADE.md Ruby script to backfill the `fingerprint` column for existing `SolidErrors::Error` records that do not yet have one. It calculates a SHA256 hash from key error attributes and updates the records. ```ruby SolidErrors::Error.where(fingerprint: nil).find_each do |error| error_attributes = error.attributes.slice('exception_class', 'message', 'severity', 'source') fingerprint = Digest::SHA256.hexdigest(error_attributes.values.join) error.update_attribute(:fingerprint, fingerprint) end ``` -------------------------------- ### Example of Overwriting Solid Errors Application Layout Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This ERB snippet demonstrates how to customize the `application.html.erb` layout for Solid Errors. It shows a basic HTML structure with placeholders for content and conditional display of flash messages, excluding the default footer and auto-disappearing flashes. ```erb Solid Errors <%= csrf_meta_tags %> <%= csp_meta_tag %> <%= render "layouts/solid_errors/style" %>
<%= content_for?(:content) ? yield(:content) : yield %>
<% if notice.present? %>

<%= notice %>

<% end %> <% if alert.present? %>

<%= alert %>

<% end %>
``` -------------------------------- ### Ruby: Report Errors with Custom Options using Rails.error.handle Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This example demonstrates how to pass custom options like `context` and `severity` to `Rails.error.handle`. These options allow you to enrich the error report with specific details, such as a user ID or a custom severity level. ```ruby Rails.error.handle(context: { user_id: user.id }, severity: :info) do # ... end ``` -------------------------------- ### Define Solid Errors 0.4.0 Schema Migration Source: https://github.com/fractaledmind/solid_errors/blob/main/UPGRADE.md Defines the `up` and `down` methods for the `UpgradeSolidErrors` migration. It modifies `solid_errors` table columns to `text` type, adds a `fingerprint` column, and updates unique indexes to use the new `fingerprint`. ```ruby class UpgradeSolidErrors < ActiveRecord::Migration[7.1] def up change_column :solid_errors, :exception_class, :text, null: false, limit: nil change_column :solid_errors, :message, :text, null: false, limit: nil change_column :solid_errors, :severity, :text, null: false, limit: nil change_column :solid_errors, :source, :text, null: true, limit: nil add_column :solid_errors, :fingerprint, :string, limit: 64 add_index :solid_errors, :fingerprint, unique: true remove_index :solid_errors, [:exception_class, :message, :severity, :source], unique: true end def down change_column :solid_errors, :exception_class, :string, null: false, limit: 200 change_column :solid_errors, :message, :string, null: false, limit: nil change_column :solid_errors, :severity, :string, null: false, limit: 25 change_column :solid_errors, :source, :string, null: true, limit: nil remove_index :solid_errors, [:fingerprint], unique: true remove_column :solid_errors, :fingerprint, :string, limit: 64 add_index :solid_errors, [:exception_class, :message, :severity, :source], unique: true end } ``` -------------------------------- ### Screen Reader Only Utility Class (Incomplete) Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Starts the definition for a `.sr-only` class, typically used to visually hide elements while keeping them accessible to screen readers. The provided snippet is incomplete. ```CSS .sr-only{ positi ``` -------------------------------- ### Configure MySQL/PostgreSQL/Trilogy Database for Solid Errors Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Configures `config/database.yml` for MySQL, PostgreSQL, or Trilogy, setting up a dedicated `errors` database that inherits primary database settings. ```yaml production: primary: &primary_production <<: *default database: app_production username: app password: <%= ENV["APP_DATABASE_PASSWORD"] %> errors: <<: *primary_production database: app_production_errors migrations_paths: db/errors_migrate ``` -------------------------------- ### Configure Solid Errors Authentication with Environment Variables Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet demonstrates how to set the username and password for Solid Errors basic HTTP authentication using environment variables. These variables are checked by Solid Errors to enable dashboard security. ```ruby ENV["SOLIDERRORS_USERNAME"] = "frodo" ENV["SOLIDERRORS_PASSWORD"] = "ikeptmysecrets" ``` -------------------------------- ### Configure SQLite Database for Solid Errors Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Configures `config/database.yml` for a SQLite database, defining a separate `errors` database for Solid Errors with its own migration path. ```yaml production: primary: <<: *default database: storage/production.sqlite3 errors: <<: *default database: storage/production_errors.sqlite3 migrations_paths: db/errors_migrate ``` -------------------------------- ### Solid Errors Default View Directory Structure Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This snippet illustrates the default file structure for views within the Solid Errors gem, showing the paths where layout, error, and occurrence templates are located. Users can replicate this structure in their application to override default views. ```bash app/views/ ├── layouts │   └── solid_errors │   ├── _style.html │   └── application.html.erb └── solid_errors ├── error_mailer │   ├── error_occurred.html.erb │   └── error_occurred.text.erb ├── errors │   ├── _actions.html.erb │   ├── _error.html.erb │   ├── _row.html.erb │   ├── index.html.erb │   └── show.html.erb └── occurrences ├── _collection.html.erb └── _occurrence.html.erb ``` -------------------------------- ### APIDOC: Solid Errors Configuration Options Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Solid Errors can be configured via the Rails configuration object under the `solid_errors` key. These options control various aspects, including database connection, authentication, email notifications, and record destruction. ```APIDOC Solid Errors Configuration Options (config.solid_errors): - connects_to: Hash Description: The database configuration to use for the Solid Errors database. See Database Configuration. - username: String Description: The username for HTTP authentication. - password: String Description: The password for HTTP authentication. - sends_email: Boolean Description: Whether to send emails when an error occurs. - email_from: String Description: The email address to send notifications from. - email_to: String or Array Description: The email address(es) to send notifications to. - email_subject_prefix: String Description: Prefix added to the subject line for email notifications. - base_controller_class: String Description: Specify a different controller as the base class for the Solid Errors controller. - destroy_after: Integer Description: If set, resolved records older than this value will be periodically destroyed. ``` -------------------------------- ### Ruby: Configure Solid Errors for Single Separate Database Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This configuration snippet shows how to set `config.solid_errors.connects_to` to use a single, separate database specifically for Solid Errors records. This is the recommended approach for managing error data. ```ruby # Use a single separate DB for Solid Errors config.solid_errors.connects_to = { database: { writing: :solid_errors, reading: :solid_errors } } ``` -------------------------------- ### Configure Solid Errors Authentication in Initializer Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet shows how to configure Solid Errors authentication credentials within a Rails initializer file. It uses `Rails.application.credentials` for secure storage of username and password. ```ruby # Set authentication credentials for Solid Errors config.solid_errors.username = Rails.application.credentials.solid_errors.username config.solid_errors.password = Rails.application.credentials.solid_errors.password ``` -------------------------------- ### APIDOC: Rails Error Reporting API Options Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md The `Rails.error.handle`, `Rails.error.record`, and `Rails.error.report` APIs support common options to provide more context and control over error reporting. These options are passed along to all registered subscribers. ```APIDOC Options for Rails.error.handle, Rails.error.record, Rails.error.report: - handled: Boolean Description: Indicates if the error was handled. Default is `true` for `#handle`, `false` for `#record`. - severity: Symbol Expected values: `:error`, `:warning`, `:info`. Default is `:warning` for `#handle`, `:error` for `#record`. Description: Describes the severity level of the error. - context: Hash Description: A hash to provide additional context about the error, such as request or user details. - source: String Default: "application". Description: A string indicating the source of the error. Useful for subscribers to filter errors. ``` -------------------------------- ### Responsive Container Class Definition Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Defines a responsive `.container` class that sets its width to 100% by default and applies increasing `max-width` values at different breakpoints (sm, md, lg, xl, 2xl) for responsive layouts. ```CSS .container{ width: 100% } @media (min-width: 640px){ .container{ max-width: 640px } } @media (min-width: 768px){ .container{ max-width: 768px } } @media (min-width: 1024px){ .container{ max-width: 1024px } } @media (min-width: 1280px){ .container{ max-width: 1280px } } @media (min-width: 1536px){ .container{ max-width: 1536px } } ``` -------------------------------- ### Configure Solid Errors Email Notifications via Environment Variables Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet shows how to enable and configure email notifications for Solid Errors using environment variables. It allows setting the sender, recipient(s), and an optional subject prefix for error notification emails. ```ruby ENV["SOLIDERRORS_SEND_EMAILS"] = true # defaults to false ENV["SOLIDERRORS_EMAIL_FROM"] = "errors@myapp.com" # defaults to "solid_errors@noreply.com" ENV["SOLIDERRORS_EMAIL_TO"] = "devs@myapp.com" # no default, must be set ENV["SOLIDERRORS_EMAIL_SUBJECT_PREFIX"] = "[Application name][Environment]" # no default, optional ``` -------------------------------- ### Mount Solid Errors Engine in Rails Routes Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Mounts the Solid Errors engine at a specified path in `config/routes.rb`, restricting access to authenticated admin users. ```ruby authenticate :user, -> (user) { user.admin? } do mount SolidErrors::Engine, at: "/solid_errors" end ``` -------------------------------- ### Configure Solid Errors Email Notifications in Initializer Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet demonstrates how to configure Solid Errors email notifications directly within a Rails initializer. It allows setting the `send_emails` flag, `email_from`, `email_to`, and `email_subject_prefix` for error alerts. ```ruby # Set authentication credentials and optional subject prefix for Solid Errors config.solid_errors.send_emails = true config.solid_errors.email_from = "errors@myapp.com" config.solid_errors.email_to = "devs@myapp.com" config.solid_errors.email_subject_prefix = "[#{Rails.application.name}][#{Rails.env}]" ``` -------------------------------- ### Set Summary Element Display in Webkit Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Adds the correct display property for the `summary` element in Chrome and Safari. ```CSS summary { display: list-item; } ``` -------------------------------- ### Add Middleware for Solid Errors UI in API-Only Rails Apps Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet shows the necessary middleware to add to `config/application.rb` for API-only Rails applications to enable the Solid Errors dashboard UI. These middleware are required for session and cookie management. ```ruby # /config/application.rb config.middleware.use ActionDispatch::Cookies config.middleware.use ActionDispatch::Session::CookieStore config.middleware.use ActionDispatch::Flash ``` -------------------------------- ### Ruby: Report and Re-raise Errors with Rails.error.record Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md `Rails.error.record` reports errors to all registered subscribers and then re-raises the error. This means that any code following the block will not be executed, as the error propagates up the call stack. ```ruby Rails.error.record do 1 + '1' # raises TypeError end 1 + 1 # This won't be executed ``` -------------------------------- ### Ruby: Report and Handle Errors with Rails.error.handle Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md `Rails.error.handle` reports any error raised within its block. It then swallows the error, allowing the rest of your code outside the block to continue execution normally. The block returns `nil` if an error occurs. ```ruby result = Rails.error.handle do 1 + '1' # raises TypeError end result # => nil 1 + 1 # This will be executed ``` -------------------------------- ### Define Tailwind CSS Custom Properties for Backdrop Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Initializes a comprehensive set of Tailwind CSS custom properties (CSS variables) for various transformations, filters, rings, shadows, and backdrops specifically for the `::backdrop` pseudo-element. ```CSS ::backdrop{ --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgb(59 130 246 / 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-shadow-colored: 0 0 #0000; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: } ``` -------------------------------- ### Reset Link Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Resets links to optimize for opt-in styling by inheriting color and text decoration, rather than requiring opt-out resets. ```css a { color: inherit; text-decoration: inherit; } ``` -------------------------------- ### Override Solid Errors Base Controller Class Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet demonstrates how to specify a custom base controller class for Solid Errors. This allows developers to integrate Solid Errors into an existing administration interface or apply custom logic to its controllers. ```ruby # Override the base controller class with your own controller config.solid_errors.base_controller_class = "YourAdminController" ``` -------------------------------- ### Normalize HTML and Host Element Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Applies consistent sensible line-height, prevents font size adjustments on iOS, uses a more readable tab size, sets default sans-serif font, and disables tap highlights on iOS for html and :host elements. ```css html, :host { line-height: 1.5; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ -moz-tab-size: 4; /* 3 */ tab-size: 4; /* 3 */ font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */ font-feature-settings: normal; /* 5 */ font-variation-settings: normal; /* 6 */ -webkit-tap-highlight-color: transparent; /* 7 */ } ``` -------------------------------- ### Normalize Placeholder Opacity and Color Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Resets the default placeholder opacity in Firefox and sets the default placeholder color to a specific gray shade. ```CSS input::placeholder, textarea::placeholder { opacity: 1; color: #9ca3af; } ``` -------------------------------- ### Reset Default Margins, Paddings, and List Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes default spacing and borders for common block-level elements, form elements, lists, and dialogs to provide a clean base for styling. ```CSS blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre { margin: 0; } fieldset { margin: 0; padding: 0; } legend { padding: 0; } ol, ul, menu { list-style: none; margin: 0; padding: 0; } dialog { padding: 0; } ``` -------------------------------- ### Set Default Cursor for Buttons Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Sets the default cursor for buttons and elements with `role="button"` to a pointer, while ensuring disabled buttons retain the default cursor. ```CSS button, [role="button"] { cursor: pointer; } :disabled { cursor: default; } ``` -------------------------------- ### Constrain Images and Videos to Parent Width Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Constrains images and videos to their parent's width and preserves their intrinsic aspect ratio, ensuring responsive media. ```CSS img, video { max-width: 100%; height: auto; } ``` -------------------------------- ### Add Custom Context to Rails Errors Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md Adds a `before_action` to the application controller to automatically include request URL, parameters, and session information to error contexts for better debugging. ```ruby before_action { Rails.error.set_context(request_url: request.original_url, params: params, session: session.inspect) } ``` -------------------------------- ### Reset Pseudo-element Content Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Resets the --tw-content custom property for ::before and ::after pseudo-elements, ensuring a clean slate for Tailwind's utility classes. ```css ::before, ::after { --tw-content: ''; } ``` -------------------------------- ### Define Tailwind CSS Custom Properties for Global Elements Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Initializes a comprehensive set of Tailwind CSS custom properties (CSS variables) for various transformations, filters, rings, shadows, and backdrops on all elements and pseudo-elements. These variables provide a foundation for Tailwind's utility classes. ```CSS *, ::before, ::after{ --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgb(59 130 246 / 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-shadow-colored: 0 0 #0000; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: } ``` -------------------------------- ### Normalize Replaced Element Display and Alignment Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Makes replaced elements `display: block` by default and adds `vertical-align: middle` for sensible alignment, addressing common CSS remedy issues. ```CSS img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; } ``` -------------------------------- ### Ruby: Manually Report Errors with Rails.error.report Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md You can manually report errors by directly calling `Rails.error.report` and passing an exception object. This is typically used within a `rescue` block to explicitly send caught exceptions to the error reporter. ```ruby begin # code rescue StandardError => e Rails.error.report(e) end ``` -------------------------------- ### Normalize Abbreviation Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Adds correct text decoration for abbreviations with a title attribute in Chrome, Edge, and Safari, using an underline with a dotted style. ```css abbr:where([title]) { text-decoration-line: underline; text-decoration-style: dotted; } ``` -------------------------------- ### Normalize File Upload Button Styling in Webkit Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Corrects the inability to style clickable file upload buttons in iOS and Safari and ensures font properties are inherited. ```CSS ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } ``` -------------------------------- ### Restrict Solid Errors Dashboard Access with Devise Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet illustrates how to integrate Solid Errors with Devise authentication. By using a `Devise` `authenticate` constraint in the `routes.rb` file, access to the Solid Errors dashboard can be restricted to authenticated and authorized users (e.g., administrators). ```ruby authenticate :user, -> (user) { user.admin? } do mount SolidErrors::Engine, at: "/solid_errors" end ``` -------------------------------- ### Normalize Monospace Font Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Applies the user's configured monospace font family, feature settings, variation settings, and corrects odd 'em' font sizing for code, kbd, samp, and pre elements. ```css code, kbd, samp, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */ font-feature-settings: normal; /* 2 */ font-variation-settings: normal; /* 3 */ font-size: 1em; /* 4 */ } ``` -------------------------------- ### Normalize Button Appearance Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Corrects the inability to style clickable types in iOS and Safari and removes default button styles, providing a clean base for custom button styling. ```css button, [type='button'], [type='reset'], [type='submit'] { -webkit-appearance: button; /* 1 */ background-color: transparent; /* 2 */ background-image: none; /* 2 */ } ``` -------------------------------- ### Normalize Search Input Appearance in Webkit Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Corrects the odd appearance of search input fields in Chrome and Safari by setting webkit-appearance to textfield and adjusting the outline style. ```CSS [type='search'] { -webkit-appearance: textfield; outline-offset: -2px; } ``` -------------------------------- ### Reset Box Model and Borders Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Prevents padding and border from affecting element width and allows adding a border by just adding a border-width. Sets default border style and color. ```css *, ::before, ::after { box-sizing: border-box; /* 1 */ border-width: 0; /* 2 */ border-style: solid; /* 2 */ border-color: #e5e7eb; /* 2 */ } ``` -------------------------------- ### Configure Solid Errors to Destroy Records After 6 Months Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet configures Solid Errors to automatically destroy resolved error records older than 6 months. This provides flexibility in data retention policies for error logs. ```ruby # Automatically destroy records older than 6 months config.solid_errors.destroy_after = 6.months ``` -------------------------------- ### Normalize Firefox Focus Ring Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Applies the modern Firefox focus style (outline: auto) for all focusable elements, ensuring consistent and accessible focus indication. ```css :-moz-focusring { outline: auto; } ``` -------------------------------- ### Normalize Bold/Strong Font Weight Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Ensures that bold and strong elements have the correct font weight in Edge and Safari, typically bolder than inherited text. ```css b, strong { font-weight: bolder; } ``` -------------------------------- ### Normalize Progress Element Vertical Alignment Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Adds the correct vertical alignment for progress elements in Chrome and Firefox, ensuring consistent layout. ```css progress { vertical-align: baseline; } ``` -------------------------------- ### Normalize Small Text Font Size Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Sets the correct font size for 'small' elements across all browsers, typically 80% of the parent's font size. ```css small { font-size: 80%; } ``` -------------------------------- ### Configure Solid Errors to Destroy Records After 30 Days Source: https://github.com/fractaledmind/solid_errors/blob/main/README.md This Ruby snippet configures Solid Errors to automatically destroy resolved error records older than 30 days. This helps in maintaining the database size and relevance of error logs. ```ruby # Automatically destroy records older than 30 days config.solid_errors.destroy_after = 30.days ``` -------------------------------- ### Reset Heading Font Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes the default font size and weight for all heading elements (h1-h6), allowing them to inherit styles or be styled via utility classes. ```css h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; } ``` -------------------------------- ### Normalize Horizontal Rule (hr) Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Corrects height in Firefox, ensures border color inheritance, and makes horizontal rules visible by default across browsers. ```css hr { height: 0; /* 1 */ color: inherit; /* 2 */ border-top-width: 1px; /* 3 */ } ``` -------------------------------- ### Normalize Form Element Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Changes font styles, removes margin in Firefox and Safari, and removes default padding for button, input, optgroup, select, and textarea elements, ensuring consistent form control appearance. ```css button, input, optgroup, select, textarea { font-family: inherit; /* 1 */ font-feature-settings: inherit; /* 1 */ font-variation-settings: inherit; /* 1 */ font-size: 100%; /* 1 */ font-weight: inherit; /* 1 */ line-height: inherit; /* 1 */ color: inherit; /* 1 */ margin: 0; /* 2 */ padding: 0; /* 3 */ } ``` -------------------------------- ### Normalize Firefox Invalid UI Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes the additional ':invalid' styles in Firefox, preventing unwanted box-shadows on invalid form elements. ```css :-moz-ui-invalid { box-shadow: none; } ``` -------------------------------- ### Normalize Button and Select Text Transform Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes the inheritance of text transform in Edge and Firefox for button and select elements, preventing unwanted capitalization. ```css button, select { text-transform: none; } ``` -------------------------------- ### Normalize Subscript and Superscript Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Prevents 'sub' and 'sup' elements from affecting the line height in all browsers by adjusting their font size, line height, position, and vertical alignment. ```css sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sub { bottom: -0.25em; } sup { top: -0.5em; } ``` -------------------------------- ### Normalize Table Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes text indentation from table contents, corrects table border color inheritance, and removes gaps between table borders by default, ensuring consistent table rendering. ```css table { text-indent: 0; /* 1 */ border-color: inherit; /* 2 */ border-collapse: collapse; /* 3 */ } ``` -------------------------------- ### Normalize Body Styles Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes default margin from the body element and ensures line-height is inherited from the html element for easier global control. ```css body { margin: 0; /* 1 */ line-height: inherit; /* 2 */ } ``` -------------------------------- ### Remove Search Input Inner Padding in Webkit Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Removes the inner padding in Chrome and Safari on macOS for search input decoration. ```CSS ::-webkit-search-decoration { -webkit-appearance: none; } ``` -------------------------------- ### Adjust Webkit Spin Button Height Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Corrects the cursor style of increment and decrement buttons in Safari by setting their height to auto. ```CSS ::-webkit-inner-spin-button, ::-webkit-outer-spin-button { height: auto; } ``` -------------------------------- ### Ensure HTML Hidden Attribute Hides Elements Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Ensures elements with the HTML `hidden` attribute remain hidden by default. ```CSS [hidden] { display: none; } ``` -------------------------------- ### Prevent Horizontal Textarea Resizing Source: https://github.com/fractaledmind/solid_errors/blob/main/app/views/layouts/solid_errors/_style.html Prevents textareas from being resized horizontally by default, allowing only vertical resizing. ```CSS textarea { resize: vertical; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.