{"id":131386,"date":"2025-10-24T11:20:14","date_gmt":"2025-10-24T02:20:14","guid":{"rendered":"https:\/\/softantenna.com\/blog\/?p=131386"},"modified":"2025-10-24T11:20:14","modified_gmt":"2025-10-24T02:20:14","slug":"rails-8-1","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/rails-8-1\/","title":{"rendered":"Rails 8.1\u304c\u6b63\u5f0f\u30ea\u30ea\u30fc\u30b9: \u7d99\u7d9a\u30b8\u30e7\u30d6\u3001\u69cb\u9020\u5316\u30a4\u30d9\u30f3\u30c8\u3001\u30ed\u30fc\u30ab\u30ebCI\u306e\u9032\u5316\u306a\u3069\u65b0\u6a5f\u80fd\u591a\u6570"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2025\/10\/s_20251024-_110806.jpg\" alt=\"\" width=\"1108\" height=\"693\" class=\"aligncenter size-full wp-image-131387\" \/><\/p>\n<p>Rails\u958b\u767a\u30c1\u30fc\u30e0\u306erafaelfranca\u6c0f\u306f10\u670822\u65e5(\u73fe\u5730\u6642\u9593)\u3001Ruby on Rails\u306e\u6700\u65b0\u7248\u300cRails 8.1\u300d\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u305f\u3053\u3068\u3092\u767a\u8868\u3057\u307e\u3057\u305f(<a href=\"https:\/\/rubyonrails.org\/2025\/10\/22\/rails-8-1\">\u516c\u5f0f\u30d6\u30ed\u30b0<\/a>)\u3002Rails 8.1\u306f\u3001500\u4eba\u4ee5\u4e0a\u306e\u8ca2\u732e\u8005\u306b\u3088\u308b2,500\u4ef6\u4ee5\u4e0a\u306e\u30b3\u30df\u30c3\u30c8\u3092\u542b\u307f\u3001Shopify\u3084HEY\u306a\u3069\u306e\u5927\u898f\u6a21\u30b5\u30fc\u30d3\u30b9\u3067\u3082\u3059\u3067\u306b\u672c\u756a\u904b\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u6ce8\u76ee\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002<\/p>\n<p><strong>Active Job\u306e\u7d99\u7d9a\u6a5f\u80fd(Continuations)<\/strong><\/p>\n<p>Active Job\u306f\u9577\u6642\u9593\u5b9f\u884c\u3055\u308c\u308b\u30b8\u30e7\u30d6\u3092\u30b9\u30c6\u30c3\u30d7\u306b\u5206\u5272\u3057\u3001\u518d\u8d77\u52d5\u5f8c\u3082\u9014\u4e2d\u304b\u3089\u518d\u958b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u7279\u306bKamal\u306e\u30c7\u30d7\u30ed\u30a4\u6642\u306b\u6709\u7528\u3067\u3001\u77ed\u3044\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u7336\u4e88(30\u79d2)\u306b\u3082\u5bfe\u5fdc\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre>\r\nclass ProcessImportJob < ApplicationJob\r\n  include ActiveJob::Continuable\r\n\r\n  def perform(import_id)\r\n    @import = Import.find(import_id)\r\n\r\n    # block format\r\n    step :initialize do\r\n      @import.initialize\r\n    end\r\n\r\n    # step with cursor, the cursor is saved when the job is interrupted\r\n    step :process do |step|\r\n      @import.records.find_each(start: step.cursor) do |record|\r\n        record.process\r\n        step.advance! from: record.id\r\n      end\r\n    end\r\n\r\n    # method format\r\n    step :finalize\r\n  end\r\n\r\n  private\r\n    def finalize\r\n      @import.finalize\r\n    end\r\nend\r\n<\/pre>\n<p><strong>\u69cb\u9020\u5316\u30a4\u30d9\u30f3\u30c8\u30ec\u30dd\u30fc\u30c8(Structured Event Reporting)<\/strong><\/p>\n<p>\u30ed\u30b0\u304c\u4eba\u9593\u3060\u3051\u3067\u306a\u304f\u6a5f\u68b0\u306b\u3082\u512a\u3057\u304f\u306a\u308a\u307e\u3057\u305f\u3002\u65b0\u3057\u3044Event Reporter\u306f\u3001Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u69cb\u9020\u5316\u3055\u308c\u305f\u30a4\u30d9\u30f3\u30c8\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u7d71\u4e00\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u30bf\u30b0\u3084\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u4ed8\u304d\u3067\u30a4\u30d9\u30f3\u30c8\u3092\u901a\u77e5\u3057\u3001\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d0\u30fc\u304c\u67d4\u8edf\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\r\nRails.event.notify(\"user.signup\", user_id: 123, email: \"user@example.com\")\r\n<\/pre>\n<p><strong>\u30ed\u30fc\u30ab\u30ebCI\u306e\u6a19\u6e96\u5316<\/strong><\/p>\n<p>\u9ad8\u901f\u306a\u958b\u767a\u30de\u30b7\u30f3\u3092\u6d3b\u304b\u3057\u3066\u3001\u30af\u30e9\u30a6\u30c9\u306b\u983c\u3089\u306a\u3044CI\u74b0\u5883\u304c\u69cb\u7bc9\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002HEY\u306e3\u4e07\u4ef6\u4ee5\u4e0a\u306e\u30c6\u30b9\u30c8\u3082\u30ed\u30fc\u30ab\u30eb\u30672\u5206\u4ee5\u5185\u306b\u5b8c\u4e86\u3057\u307e\u3059(\u30af\u30e9\u30a6\u30c9\u3067\u306f10\u5206\u4ee5\u4e0a\u5fc5\u8981\u3060\u3063\u305f\u3082\u306e)\u3002<\/p>\n<pre>\r\nCI.run do\r\n  step \"Setup\", \"bin\/setup --skip-server\"\r\n  step \"Style: Ruby\", \"bin\/rubocop\"\r\n\r\n  step \"Security: Gem audit\", \"bin\/bundler-audit\"\r\n  step \"Security: Importmap vulnerability audit\", \"bin\/importmap audit\"\r\n  step \"Security: Brakeman code analysis\", \"bin\/brakeman --quiet --no-pager --exit-on-warn --exit-on-error\"\r\n  step \"Tests: Rails\", \"bin\/rails test\"\r\n  step \"Tests: Seeds\", \"env RAILS_ENV=test bin\/rails db:seed:replant\"\r\n\r\n  # Requires the `gh` CLI and `gh extension install basecamp\/gh-signoff`.\r\n  if success?\r\n    step \"Signoff: All systems go. Ready for merge and deploy.\", \"gh signoff\"\r\n  else\r\n    failure \"Signoff: CI failed. Do not merge or deploy.\", \"Fix the issues and try again.\"\r\n  end\r\nend\r\n<\/pre>\n<p>\u305d\u306e\u4ed6\u3001Markdown\u5bfe\u5fdc\u306e\u5f37\u5316\u3084\u3001Kamal\u306e\u8a8d\u8a3c\u60c5\u5831\u53d6\u5f97\u6a5f\u80fd\u306e\u6539\u826f\u3001\u975e\u63a8\u5968\u30a2\u30bd\u30b7\u30a8\u30fc\u30b7\u30e7\u30f3\u306e\u660e\u793a\u6a5f\u80fd\u306e\u8ffd\u52a0\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306a\u65b0\u6a5f\u80fd\u30fb\u6539\u826f\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>Rails 8.1\u306f\u3001\u958b\u767a\u8005\u4f53\u9a13\u3092\u4e00\u6bb5\u3068\u9ad8\u3081\u308b\u6a5f\u80fd\u304c\u6e80\u8f09\u3067\u3059\u3002\u8a73\u7d30\u306f\u516c\u5f0fCHANGELOG\u3092\u3054\u89a7\u304f\u3060\u3055\u3044<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rails\u958b\u767a\u30c1\u30fc\u30e0\u306erafaelfranca\u6c0f\u306f10\u670822\u65e5(\u73fe\u5730\u6642\u9593)\u3001Ruby on Rails\u306e\u6700\u65b0\u7248\u300cRails 8.1\u300d\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u305f\u3053\u3068\u3092\u767a\u8868\u3057\u307e\u3057\u305f(\u516c\u5f0f\u30d6\u30ed\u30b0)\u3002Rails 8.1\u306f\u3001500\u4eba\u4ee5\u4e0a\u306e\u8ca2\u732e [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":131387,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[350,154],"class_list":["post-131386","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-rails","tag-ruby"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/131386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=131386"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/131386\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/131387"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=131386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=131386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=131386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}