{"id":2253,"date":"2013-03-04T18:01:03","date_gmt":"2013-03-04T09:01:03","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=2253"},"modified":"2018-11-14T16:33:55","modified_gmt":"2018-11-14T07:33:55","slug":"activesupport-%e3%81%ae-strip_heredoc-%e3%81%a7%e3%83%92%e3%82%a2%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e3%82%92%e7%b6%ba%e9%ba%97%e3%81%ab%e6%9b%b8%e3%81%8f","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2013\/03\/04\/activesupport-%e3%81%ae-strip_heredoc-%e3%81%a7%e3%83%92%e3%82%a2%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e3%82%92%e7%b6%ba%e9%ba%97%e3%81%ab%e6%9b%b8%e3%81%8f\/","title":{"rendered":"ActiveSupport \u306e strip_heredoc \u3067\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u7dba\u9e97\u306b\u66f8\u304f"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n<p>ActiveSpport \u306e strip_heredoc \u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u3054\u5b58\u77e5\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>&nbsp;<\/p>\n<h2>\u884c\u982d\u306e\u4e0d\u8981\u306a\u30a4\u30f3\u30c7\u30f3\u30c8<\/h2>\n<p>\u4ee5\u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u898b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"lang:ruby decode:true\"># coding: utf-8\r\nrequire 'active_support\/core_ext\/string\/strip'\r\n\r\nputs &lt;&lt;-'EOS'\r\n  \u304a\u3058\u3044\u3055\u3093\u306f\u3001\u5c71\u3078\u829d\u5208\u308a\u306b\u3002\r\n  \u304a\u3070\u3042\u3055\u3093\u306f\u3001\u5ddd\u3078\u6d17\u6fef\u7269\u306b\u3002\r\nEOS<\/pre>\n<p>\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">  \u304a\u3058\u3044\u3055\u3093\u306f\u3001\u5c71\u3078\u829d\u5208\u308a\u306b\u3002\r\n  \u304a\u3070\u3042\u3055\u3093\u306f\u3001\u5ddd\u3078\u6d17\u6fef\u7269\u306b\u3002<\/pre>\n<p>\u884c\u982d\u304c\u30a4\u30f3\u30c7\u30f3\u30c8\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u30fb\u30fb\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>strip_heredoc \u3067\u884c\u982d\u306e\u30a4\u30f3\u30c7\u30f3\u30c8\u3092\u6d88\u3059<\/h2>\n<p>strip_heredoc \u3092\u4f7f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\"># coding: utf-8\r\nrequire 'active_support\/core_ext\/string\/strip'\r\n\r\nputs &lt;&lt;-'EOS'.strip_heredoc     # strip_heredoc \u3092\u4f7f\u3063\u305f\r\n  \u304a\u3058\u3044\u3055\u3093\u306f\u3001\u5c71\u3078\u829d\u5208\u308a\u306b\u3002\r\n  \u304a\u3070\u3042\u3055\u3093\u306f\u3001\u5ddd\u3078\u6d17\u6fef\u7269\u306b\u3002\r\n  \u3081\u3067\u305f\u3057\u3001\u3081\u3067\u305f\u3057\u3002\r\nEOS<\/pre>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">\u304a\u3058\u3044\u3055\u3093\u306f\u3001\u5c71\u3078\u829d\u5208\u308a\u306b\u3002\r\n\u304a\u3070\u3042\u3055\u3093\u306f\u3001\u5ddd\u3078\u6d17\u6fef\u7269\u306b\u3002\r\n\u3081\u3067\u305f\u3057\u3001\u3081\u3067\u305f\u3057\u3002<\/pre>\n<p>\u826f\u3044\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u3082\u3046\u5c11\u3057\u9577\u3044\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u3082\u8a66\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true \"># coding: utf-8\r\nrequire 'active_support\/core_ext\/string\/strip'\r\n\r\nputs &lt;&lt;-'EOS'.strip_heredoc\r\n  SELECT\r\n    *\r\n  FROM\r\n    sales_details\r\n    LEFT OUTER JOIN products ON products.id=sales_details.product_id\r\n    LEFT OUTER JOIN product_categories ON product_categories.id=products.product_category_id\r\n    LEFT OUTER JOIN sales ON sales.id=sales_details.sales_id\r\n    LEFT OUTER JOIN shops ON shops.id=sales.shop_id\r\n    LEFT OUTER JOIN coupons ON coupons.id=sales.coupon_id\r\n    LEFT OUTER JOIN customers ON customers.id=sales.customer_id\r\n    LEFT OUTER JOIN occupations ON occupations.id=customers.occupation_id\r\n    LEFT OUTER JOIN prefectures ON prefectures.code=customer.prefecture_code\r\n  WHERE\r\n    sales.sold_at &lt; '2000-01-01'\r\n    AND products.name LIKE '%Web \u9650\u5b9a%'\r\n    AND product_categories.name IN ('\u91ce\u83dc', '\u304a\u7c73', '\u9b5a\u4ecb\u985e')\r\n    AND shops.name IN ('\u4eac\u90fd\u652f\u5e97', '\u5317\u6d77\u9053\u652f\u5e97', '\u540d\u53e4\u5c4b\u652f\u5e97')\r\n    AND coupons.name = 'Web \u4f1a\u54e1\u9650\u5b9a\u30af\u30fc\u30dd\u30f3'\r\n    AND customer.gender = '\u7537\u6027'\r\n    AND occupations.name IN ('\u81ea\u55b6\u696d', '\u6559\u5e2b', '\u533b\u8005')\r\n    AND prefectures.name = '\u4eac\u90fd'\r\n  ORDER BY\r\n    sales_details.sold_at DESC,\r\n    products.name,\r\n    product_categories.name,\r\n    shops.name,\r\n    occupation.name\r\n  ;\r\nEOS<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\u306f\u3001\u3001\u3001<\/p>\n<pre class=\"lang:default decode:true\">SELECT\r\n  *\r\nFROM\r\n  sales_details\r\n  LEFT OUTER JOIN products ON products.id=sales_details.product_id\r\n  LEFT OUTER JOIN product_categories ON product_categories.id=products.product_category_id\r\n  LEFT OUTER JOIN sales ON sales.id=sales_details.sales_id\r\n  LEFT OUTER JOIN shops ON shops.id=sales.shop_id\r\n  LEFT OUTER JOIN coupons ON coupons.id=sales.coupon_id\r\n  LEFT OUTER JOIN customers ON customers.id=sales.customer_id\r\n  LEFT OUTER JOIN occupations ON occupations.id=customers.occupation_id\r\n  LEFT OUTER JOIN prefectures ON prefectures.code=customer.prefecture_code\r\nWHERE\r\n  sales.sold_at &lt; '2000-01-01'\r\n  AND products.name LIKE '%Web \u9650\u5b9a%'\r\n  AND product_categories.name IN ('\u91ce\u83dc', '\u304a\u7c73', '\u9b5a\u4ecb\u985e')\r\n  AND shops.name IN ('\u4eac\u90fd\u652f\u5e97', '\u5317\u6d77\u9053\u652f\u5e97', '\u540d\u53e4\u5c4b\u652f\u5e97')\r\n  AND coupons.name = 'Web \u4f1a\u54e1\u9650\u5b9a\u30af\u30fc\u30dd\u30f3'\r\n  AND customer.gender = '\u7537\u6027'\r\n  AND occupations.name IN ('\u81ea\u55b6\u696d', '\u6559\u5e2b', '\u533b\u8005')\r\n  AND prefectures.name = '\u4eac\u90fd'\r\nORDER BY\r\n  sales_details.sold_at DESC,\r\n  products.name,\r\n  product_categories.name,\r\n  shops.name,\r\n  occupation.name\r\n;<\/pre>\n<p>\u826f\u3044\u611f\u3058\u30fb\u30fb\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u9234\u6728\u3067\u3059\u3002<\/p>\n<p>ActiveSpport \u306e strip_heredoc \u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u3054\u5b58\u77e5\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>&nbsp;<br \/>\n\u884c\u982d\u306e\u4e0d\u8981\u306a\u30a4\u30f3\u30c7\u30f3\u30c8<br \/>\n\u4ee5\u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u898b\u3066\u304f\u3060\u3055\u3044\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2013\/03\/04\/activesupport-%e3%81%ae-strip_heredoc-%e3%81%a7%e3%83%92%e3%82%a2%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e3%82%92%e7%b6%ba%e9%ba%97%e3%81%ab%e6%9b%b8%e3%81%8f\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[68,22,24],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2253"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=2253"}],"version-history":[{"count":1,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2253\/revisions"}],"predecessor-version":[{"id":17948,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2253\/revisions\/17948"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=2253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=2253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=2253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}