{"id":1250,"date":"2011-08-02T13:29:45","date_gmt":"2011-08-02T04:29:45","guid":{"rendered":"https:\/\/wp-78qb7hnp.pistolfly.jp\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html"},"modified":"2011-08-02T13:29:45","modified_gmt":"2011-08-02T04:29:45","slug":"activerecordrecordnotsaved-b","status":"publish","type":"post","link":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html","title":{"rendered":"ActiveRecord::RecordNotSaved - before_save problem"},"content":{"rendered":"<p>ActiveRecord\u306e\u30af\u30e9\u30b9\u3067\u3001before_* \u30b3\u30fc\u30eb\u30d0\u30c3\u30af \u304cfalse\u3092\u8fd4\u3059\u3068\u3001\u4ee5\u964d\u306e\u51e6\u7406\u304c\u30ad\u30e3\u30f3\u30bb\u30eb\u3055\u308c\u3066\u3057\u307e\u3046\u304b\u3089\u3001save\u3082\u3055\u308c\u306a\u304f\u306a\u308b\u3002<br \/>\nRuby\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u6700\u5f8c\u306b\u8a55\u4fa1\u3055\u308c\u305f\u5f0f\u304c\u8fd4\u308a\u5024\u306b\u306a\u308b\u304b\u3089\u3001\u3046\u3063\u304b\u308a\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304cfalse\u3092\u8fd4\u3057\u3066\u3057\u307e\u3044\u3001save\u3067\u5909\u66f4\u304c\u4fdd\u5b58\u3055\u308c\u305a\u3001\u300c\u3069\u3046\u3057\u3066\u306a\u306e\u304b\uff1f\u300d\u3068\u306f\u307e\u308b\u3053\u3068\u304c\u3042\u308b\u3002<br \/>\n\u305d\u3046\u3044\u3046\u6642\u306f\u660e\u793a\u7684\u306b\u30e1\u30bd\u30c3\u30c9\u3092<br \/>\ntrue<br \/>\n\u3067\u7d42\u308f\u308b\u3088\u3046\u306b\u3059\u308b\u3002<br \/>\nafter_* \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304cfalse\u3092\u8fd4\u3059\u5834\u5408\u3082\u3001\u4ee5\u964d\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u30ad\u30e3\u30f3\u30bb\u30eb\u3055\u308c\u3066\u3057\u307e\u3046\u3002<\/p>\n<blockquote><p>If a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last. <\/p><\/blockquote>\n<p><a href=\"http:\/\/www.dansketcher.com\/2006\/12\/30\/activerecordrecordnotsaved-before_save-problem\/\" target=\"_blank\">Sketchpad - Dan Sketcher's personal blog \u00bb Blog Archive \u00bb ActiveRecord::RecordNotSaved - before_save problem<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ActiveRecord\u306e\u30af\u30e9\u30b9\u3067\u3001before_* \u30b3\u30fc\u30eb\u30d0\u30c3\u30af \u304cfalse\u3092\u8fd4\u3059\u3068\u3001\u4ee5\u964d\u306e\u51e6\u7406\u304c\u30ad\u30e3\u30f3\u30bb\u30eb\u3055\u308c\u3066\u3057\u307e\u3046\u304b\u3089\u3001save\u3082\u3055\u308c\u306a\u304f\u306a\u308b\u3002 Ruby\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u6700\u5f8c\u306b\u8a55\u4fa1\u3055\u308c\u305f\u5f0f\u304c\u8fd4\u308a\u5024\u306b\u306a\u308b\u304b\u3089\u3001\u3046\u3063\u304b &hellip; <a href=\"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">ActiveRecord::RecordNotSaved - before_save problem<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[31],"tags":[],"class_list":["post-1250","post","type-post","status-publish","format-standard","hentry","category-ruby-on-rails","ja"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ActiveRecord::RecordNotSaved - before_save problem - Pistolfly<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ActiveRecord::RecordNotSaved - before_save problem - Pistolfly\" \/>\n<meta property=\"og:description\" content=\"ActiveRecord\u306e\u30af\u30e9\u30b9\u3067\u3001before_* \u30b3\u30fc\u30eb\u30d0\u30c3\u30af \u304cfalse\u3092\u8fd4\u3059\u3068\u3001\u4ee5\u964d\u306e\u51e6\u7406\u304c\u30ad\u30e3\u30f3\u30bb\u30eb\u3055\u308c\u3066\u3057\u307e\u3046\u304b\u3089\u3001save\u3082\u3055\u308c\u306a\u304f\u306a\u308b\u3002 Ruby\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u6700\u5f8c\u306b\u8a55\u4fa1\u3055\u308c\u305f\u5f0f\u304c\u8fd4\u308a\u5024\u306b\u306a\u308b\u304b\u3089\u3001\u3046\u3063\u304b &hellip; \u7d9a\u304d\u3092\u8aad\u3080 ActiveRecord::RecordNotSaved - before_save problem &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html\" \/>\n<meta property=\"og:site_name\" content=\"Pistolfly\" \/>\n<meta property=\"article:published_time\" content=\"2011-08-02T04:29:45+00:00\" \/>\n<meta name=\"author\" content=\"Pistolfly\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pistolfly\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html\"},\"author\":{\"name\":\"Pistolfly\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\"},\"headline\":\"ActiveRecord::RecordNotSaved - before_save problem\",\"datePublished\":\"2011-08-02T04:29:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html\"},\"wordCount\":84,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\"},\"articleSection\":[\"Ruby on Rails\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html\",\"url\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html\",\"name\":\"ActiveRecord::RecordNotSaved - before_save problem - Pistolfly\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#website\"},\"datePublished\":\"2011-08-02T04:29:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/2011\\\/08\\\/activerecordrecordnotsaved-b.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ActiveRecord::RecordNotSaved - before_save problem\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#website\",\"url\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/\",\"name\":\"Pistolfly\",\"description\":\"Developer Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\",\"name\":\"Pistolfly\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\",\"caption\":\"Pistolfly\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\"},\"description\":\"Software Engineer in Tokyo, Japan\",\"url\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/author\\\/pistolfly\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ActiveRecord::RecordNotSaved - before_save problem - Pistolfly","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html","og_locale":"ja_JP","og_type":"article","og_title":"ActiveRecord::RecordNotSaved - before_save problem - Pistolfly","og_description":"ActiveRecord\u306e\u30af\u30e9\u30b9\u3067\u3001before_* \u30b3\u30fc\u30eb\u30d0\u30c3\u30af \u304cfalse\u3092\u8fd4\u3059\u3068\u3001\u4ee5\u964d\u306e\u51e6\u7406\u304c\u30ad\u30e3\u30f3\u30bb\u30eb\u3055\u308c\u3066\u3057\u307e\u3046\u304b\u3089\u3001save\u3082\u3055\u308c\u306a\u304f\u306a\u308b\u3002 Ruby\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u6700\u5f8c\u306b\u8a55\u4fa1\u3055\u308c\u305f\u5f0f\u304c\u8fd4\u308a\u5024\u306b\u306a\u308b\u304b\u3089\u3001\u3046\u3063\u304b &hellip; \u7d9a\u304d\u3092\u8aad\u3080 ActiveRecord::RecordNotSaved - before_save problem &rarr;","og_url":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html","og_site_name":"Pistolfly","article_published_time":"2011-08-02T04:29:45+00:00","author":"Pistolfly","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"Pistolfly"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html#article","isPartOf":{"@id":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html"},"author":{"name":"Pistolfly","@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab"},"headline":"ActiveRecord::RecordNotSaved - before_save problem","datePublished":"2011-08-02T04:29:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html"},"wordCount":84,"commentCount":0,"publisher":{"@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab"},"articleSection":["Ruby on Rails"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html","url":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html","name":"ActiveRecord::RecordNotSaved - before_save problem - Pistolfly","isPartOf":{"@id":"https:\/\/www.pistolfly.com\/weblog\/#website"},"datePublished":"2011-08-02T04:29:45+00:00","breadcrumb":{"@id":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pistolfly.com\/weblog\/2011\/08\/activerecordrecordnotsaved-b.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/www.pistolfly.com\/weblog"},{"@type":"ListItem","position":2,"name":"ActiveRecord::RecordNotSaved - before_save problem"}]},{"@type":"WebSite","@id":"https:\/\/www.pistolfly.com\/weblog\/#website","url":"https:\/\/www.pistolfly.com\/weblog\/","name":"Pistolfly","description":"Developer Blog","publisher":{"@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pistolfly.com\/weblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab","name":"Pistolfly","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g","caption":"Pistolfly"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g"},"description":"Software Engineer in Tokyo, Japan","url":"https:\/\/www.pistolfly.com\/weblog\/author\/pistolfly"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paorzz-ka","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts\/1250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/comments?post=1250"}],"version-history":[{"count":0,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts\/1250\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/media?parent=1250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/categories?post=1250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/tags?post=1250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}