| 日時: | 2023-12-03 |
|---|---|
| 作: | voluntas |
| バージョン: | 2023.1 |
| url: | https://voluntas.github.io |
この記事が良いと思ったらこの記事に Star をお願いします
| 日時: | 2023-12-03 |
|---|---|
| 作: | voluntas |
| バージョン: | 2023.1 |
| url: | https://voluntas.github.io |
この記事が良いと思ったらこの記事に Star をお願いします
| 更新: | 2024-05-20 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2024.1 |
| URL: | https://voluntas.github.io/ |
| class MyJob < ActiveJob::Base | |
| queue_as :urgent | |
| rescue_from(NoResultsError) do | |
| retry_job wait: 5.minutes, queue: :default | |
| end | |
| def perform(*args) | |
| MyService.call(*args) | |
| end |
| module ActiveAdmin | |
| module Filters | |
| # lib/active_admin/filters/resource_extension.rb | |
| # サイドバーの検索条件から、default_association_filters を対象外にする。 | |
| # has_manyやhas_oneがプルダウン条件になって恐ろしく重くなる現象の回避策。 | |
| module ResourceExtension | |
| # Returns a default set of filters for the associations | |
| def default_association_filters |
| class CreateItemChildrenCountView < ActiveRecord::Migration | |
| def self.up | |
| execute <<-SQL | |
| CREATE VIEW item_children_count AS | |
| SELECT parent_id AS item_id, COUNT(*) as children_count | |
| FROM items GROUP BY parent_id; | |
| SQL | |
| end | |
| def self.down |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |