{"id":3302,"date":"2018-07-11T10:00:30","date_gmt":"2018-07-11T01:00:30","guid":{"rendered":"https:\/\/blog.timecrowd.net\/?p=3302"},"modified":"2018-07-06T14:23:31","modified_gmt":"2018-07-06T05:23:31","slug":"generate-shorten-url-by-rails","status":"publish","type":"post","link":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/","title":{"rendered":"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b"},"content":{"rendered":"<p>TimeCrowd\u3067\u306f\u62db\u5f85URL\u3092\u767a\u884c\u3057\u3066\u30e1\u30f3\u30d0\u30fc\u3092\u62db\u5f85\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u305d\u306e\u969b\u306b\u76f8\u624b\u306b\u62db\u5f85URL\u3092\u9023\u7d61\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u306b\u9577\u3044\u306e\u3067\u6587\u7ae0\u5185\u306b\u57cb\u3081\u8fbc\u3080\u3068\u30a4\u30f3\u30d1\u30af\u30c8\u304c\u5f37\u3059\u304e\u308b\u3068\u3044\u3046\u8981\u671b\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u4eca\u56de\u306f\u62db\u5f85URL\u306b\u5bfe\u3057\u3066\u77ed\u7e2eURL\u3092\u4f7f\u7528\u3057\u3066\u898b\u3084\u3059\u3044\u5f62\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7121\u4e8b\u306b\u53f0\u6e7e\u3067\u30c9\u30e9\u30b4\u30f3\u30dc\u30fc\u30c8\u306e\u8a66\u5408\u3092\u7d42\u3048\u3066\u5e30\u56fd\u3057\u305f\u65c5\u3057\u3066\u304d\u305f\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u4e09\u5b85\u3067\u3059\u3002<\/p>\n<h2>Shorten\u306e\u5c0e\u5165<\/h2>\n<p>\u4eca\u56de\u306f<a href=\"https:\/\/github.com\/jpmcgrath\/shortener\" target=\"_blank\" rel=\"noopener\">Shorten<\/a>\u3068\u3044\u3046gem\u3092\u5229\u7528\u3057\u3066\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/jpmcgrath\/shortener#installation\" target=\"_blank\" rel=\"noopener\">Installation<\/a>\u3092\u53c2\u7167\u3057\u306a\u304c\u3089\u9032\u3081\u307e\u3059\u3002<\/p>\n<pre><code># Gemfile\r\ngem 'shortener'\r\n<\/code><\/pre>\n<pre><code>bin\/rails generate shortener\r\nbin\/rake db:migrate\r\nRunning via Spring preloader in process 16007\r\n== 20180706014530 CreateShortenedUrlsTable: migrating =========================\r\n-- create_table(:shortened_urls)\r\n   -&gt; 0.0302s\r\n-- add_index(:shortened_urls, :unique_key, {:unique=&gt;true})\r\n   -&gt; 0.0293s\r\n-- add_index(:shortened_urls, :url, {:length=&gt;2083})\r\nrake aborted!\r\nStandardError: An error has occurred, all later migrations canceled:\r\n\r\nMysql2::Error: Specified key was too long; max key length is 3072 bytes: CREATE  INDEX `index_shortened_urls_on_url`  ON `shortened_urls` (`url`(2083))\r\n\/Users\/kotamiyake\/code\/ruffnote\/timecrowd\/db\/migrate\/20180706014530_create_shortened_urls_table.rb:29:in `change'\r\n-e:1:in `'\r\nActiveRecord::StatementInvalid: Mysql2::Error: Specified key was too long; max key length is 3072 bytes: CREATE  INDEX `index_shortened_urls_on_url`  ON `shortened_urls` (`url`(2083))\r\n\/Users\/kotamiyake\/code\/ruffnote\/timecrowd\/db\/migrate\/20180706014530_create_shortened_urls_table.rb:29:in `change'\r\n-e:1:in `'\r\nMysql2::Error: Specified key was too long; max key length is 3072 bytes\r\n\/Users\/kotamiyake\/code\/ruffnote\/timecrowd\/db\/migrate\/20180706014530_create_shortened_urls_table.rb:29:in `change'\r\n-e:1:in `'\r\nTasks: TOP =&gt; db:migrate\r\n(See full trace by running task with --trace)<\/code><\/pre>\n<p>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3069\u3046\u3084\u3089\u30ab\u30e9\u30e0\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6700\u5927\u30ad\u30fc\u9577\u304c\u9577\u3059\u304e\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>MySQL\u3067\u306f\u57fa\u672c\u7684\u306b\u306f\u5358\u4e00\u30ab\u30e9\u30e0\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6700\u5927\u30ad\u30fc\u9577\u306f767\u30d0\u30a4\u30c8\u307e\u3067\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u7279\u5b9a\u306e\u6761\u4ef6\u3067\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6700\u5927\u30ad\u30fc\u9577\u30923072\u30d0\u30a4\u30c8\u307e\u3067\u62e1\u5f35\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>TimeCrowd\u3067\u306f\u6700\u5927\u30ad\u30fc\u95773072\u30d0\u30a4\u30c8\u307e\u3067\u62e1\u5f35\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u3067\u3082\u8db3\u308a\u306a\u304b\u3063\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><code>class CreateShortenedUrlsTable &lt; ActiveRecord::Migration[4.2]\r\n  def change\r\n    create_table :shortened_urls do |t|\r\n      # we can link this to a user for interesting things\r\n      t.integer :owner_id\r\n      t.string :owner_type, limit: 20\r\n\r\n      # the real url that we will redirect to\r\n      t.text :url, null: false, length: 2083\r\n\r\n      # the unique key\r\n      t.string :unique_key, limit: 10, null: false\r\n\r\n      # a category to help categorize shortened urls\r\n      t.string :category\r\n\r\n      # how many times the link has been clicked\r\n      t.integer :use_count, null: false, default: 0\r\n\r\n      # valid until date for expirable urls\r\n      t.datetime :expires_at\r\n\r\n      t.timestamps\r\n    end\r\n\r\n    # we will lookup the links in the db by key, urls and owners.\r\n    # also make sure the unique keys are actually unique\r\n    add_index :shortened_urls, :unique_key, unique: true\r\n    add_index :shortened_urls, :url, length: 2083\r\n    add_index :shortened_urls, [:owner_id, :owner_type]\r\n    add_index :shortened_urls, :category\r\n  end\r\nend<\/code><\/pre>\n<p>url\u306elength\u304c\u30ab\u30e9\u30e0\u9577\u3001\u30ad\u30fc\u9577\u5171\u306b2083\u6587\u5b57\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>TimeCrowd\u3067\u306f\u6587\u5b57\u30b3\u30fc\u30c9\u306butf8mb4\u3092\u63a1\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u30ab\u30e9\u30e0\u9577\u3001\u30ad\u30fc\u9577\u3092768\u6587\u5b57\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5e78\u3044\u62db\u5f85URL\u306e\u9577\u3055\u306f768\u6587\u5b57\u3092\u8d85\u3048\u306a\u3044\u306e\u3067768\u6587\u5b57\u306b\u5909\u66f4\u3057\u3066\u3001\u518d\u5ea6\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code>bin\/rake db:migrate\r\nRunning via Spring preloader in process 37580\r\n== 20180706014530 CreateShortenedUrlsTable: migrating =========================\r\n-- create_table(:shortened_urls)\r\n   -&gt; 0.0339s\r\n-- add_index(:shortened_urls, :unique_key, {:unique=&gt;true})\r\n   -&gt; 0.0286s\r\n-- add_index(:shortened_urls, :url, {:length=&gt;768})\r\n   -&gt; 0.0217s\r\n-- add_index(:shortened_urls, [:owner_id, :owner_type])\r\n   -&gt; 0.0275s\r\n-- add_index(:shortened_urls, :category)\r\n   -&gt; 0.0278s\r\n== 20180706014530 CreateShortenedUrlsTable: migrated (0.1404s) ================<\/code><\/pre>\n<p>\u7121\u4e8b\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>\u77ed\u7e2eURL\u3092\u4f7f\u3063\u3066\u30a2\u30af\u30bb\u30b9<\/h2>\n<p>\u307e\u305a\u306f\u77ed\u7e2eURL\u304b\u3089\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u305f\u3081\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><code>get '\/s\/:id' =&gt; 'shortener\/shortened_urls#show'<\/code><\/pre>\n<p>\u4f8b\u3067\u306f\u30eb\u30fc\u30c8\u76f4\u4e0b\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u77ed\u7e2eURL\u3068\u3044\u3046\u3053\u3068\u3067namespace\u3068\u3057\u3066\/s\/\u3067\u533a\u5207\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u6b21\u306b\u77ed\u7e2eURL\u3092\u767a\u884c\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre><code>pry(main)&gt; shortened_url = Shortener::ShortenedUrl.generate(\"https:\/\/timecrowd.net\")\r\npry(main)&gt; shortened_url.unique_key\r\n=&gt; \"5wr8x\"<\/code><\/pre>\n<p>\u3067\u306f\u958b\u767a\u74b0\u5883\u3092\u4f7f\u3063\u3066\u77ed\u7e2eURL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>http:\/\/localhost:3000\/s\/5wr8x<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3307\" src=\"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/screenshot-timecrowd.net-2018.07.06-12-29-08.png\" alt=\"TimeCrowd\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u753b\u50cf\" width=\"1440\" height=\"803\" srcset=\"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/screenshot-timecrowd.net-2018.07.06-12-29-08.png 1440w, https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/screenshot-timecrowd.net-2018.07.06-12-29-08-768x428.png 768w\" sizes=\"auto, (max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<p>\u6b63\u5e38\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u753b\u9762\u3067\u8868\u793a\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3310\" src=\"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-12.40.39.png\" alt=\"\u77ed\u7e2eURL\u753b\u50cf\" width=\"1132\" height=\"622\" srcset=\"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-12.40.39.png 1132w, https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-12.40.39-768x422.png 768w\" sizes=\"auto, (max-width: 1132px) 100vw, 1132px\" \/><\/p>\n<p>\u3060\u3044\u3076\u30b9\u30c3\u30ad\u30ea\u3057\u307e\u3057\u305f\u306d\uff01<\/p>\n<p>\u3053\u308c\u3067\u4eca\u307e\u3067\u306e\u9577\u3005\u3068\u3057\u305fURL\u3092\u30c1\u30e3\u30c3\u30c8\u3084\u30e1\u30fc\u30eb\u306b\u6dfb\u4ed8\u3059\u308b\u5fc5\u8981\u306f\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u3060\u3053\u3061\u3089\u306e\u6a5f\u80fd\u306f\u30ea\u30ea\u30fc\u30b9\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u8fd1\u3005\u30ea\u30ea\u30fc\u30b9\u3067\u304d\u308b\u3088\u3046\u92ed\u610f\u958b\u767a\u4e2d\u3067\u3059\u306e\u3067\u4e5e\u3046\u3054\u671f\u5f85\u304f\u3060\u3055\u3044\uff01<\/p>\n<h2>\u53c2\u8003\u8a18\u4e8b<\/h2>\n<p>\u7b2c32\u56de\u3000InnoDB\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6700\u5927\u30ad\u30fc\u9577\u306b\u3064\u3044\u3066\uff1aMySQL\u9053\u666e\u8acb\u4fbf\u308a\uff5cgihyo.jp \u2026 \u6280\u8853\u8a55\u8ad6\u793e<br \/>\n<a href=\"http:\/\/gihyo.jp\/dev\/serial\/01\/mysql-road-construction-news\/0032\" target=\"_blank\" rel=\"noopener\">http:\/\/gihyo.jp\/dev\/serial\/01\/mysql-road-construction-news\/0032<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"TimeCrowd\u3067\u306f\u62db\u5f85URL\u3092\u767a\u884c\u3057\u3066\u30e1\u30f3\u30d0\u30fc\u3092\u62db\u5f85\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u305d\u306e\u969b\u306b\u76f8\u624b\u306b\u62db\u5f85URL\u3092\u9023\u7d61\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u306b\u9577\u3044\u306e\u3067\u6587\u7ae0&#8230;","protected":false},"author":5,"featured_media":3308,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":"","footnotes":""},"categories":[5],"tags":[39,12],"class_list":["post-3302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-rails","tag-engineer-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b | TimeCrowd Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b | TimeCrowd Blog\" \/>\n<meta property=\"og:description\" content=\"TimeCrowd\u3067\u306f\u62db\u5f85URL\u3092\u767a\u884c\u3057\u3066\u30e1\u30f3\u30d0\u30fc\u3092\u62db\u5f85\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u305d\u306e\u969b\u306b\u76f8\u624b\u306b\u62db\u5f85URL\u3092\u9023\u7d61\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u306b\u9577\u3044\u306e\u3067\u6587\u7ae0...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/\" \/>\n<meta property=\"og:site_name\" content=\"TimeCrowd Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/timecrowd\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-11T01:00:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-10.33.12.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1108\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kota Miyake\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@TimeCrowd\" \/>\n<meta name=\"twitter:site\" content=\"@TimeCrowd\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kota Miyake\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/\"},\"author\":{\"name\":\"Kota Miyake\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/#\\\/schema\\\/person\\\/d40aa0ec60830d2bb70caa1691f8b60b\"},\"headline\":\"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b\",\"datePublished\":\"2018-07-11T01:00:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/\"},\"wordCount\":46,\"image\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/Screen-Shot-2018-07-06-at-10.33.12.png\",\"keywords\":[\"rails\",\"\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\"],\"articleSection\":[\"\u958b\u767a\"],\"inLanguage\":\"ja\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/\",\"url\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/\",\"name\":\"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b | TimeCrowd Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/Screen-Shot-2018-07-06-at-10.33.12.png\",\"datePublished\":\"2018-07-11T01:00:30+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/#\\\/schema\\\/person\\\/d40aa0ec60830d2bb70caa1691f8b60b\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/Screen-Shot-2018-07-06-at-10.33.12.png\",\"contentUrl\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/Screen-Shot-2018-07-06-at-10.33.12.png\",\"width\":1108,\"height\":600,\"caption\":\"\u9577\u3044\u62db\u5f85URL\u753b\u50cf\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/generate-shorten-url-by-rails\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/blog.timecrowd.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/#website\",\"url\":\"https:\\\/\\\/blog.timecrowd.net\\\/\",\"name\":\"TimeCrowd Blog\",\"description\":\"\u6642\u9593\u7ba1\u7406\u30c4\u30fc\u30eb\u300cTimeCrowd(\u30bf\u30a4\u30e0\u30af\u30e9\u30a6\u30c9)\u300d\u306e\u30d6\u30ed\u30b0\u3067\u3059\u3002\u30ea\u30e2\u30fc\u30c8\u30ef\u30fc\u30af\u3001\u30c6\u30ec\u30ef\u30fc\u30af\u3001\u30bf\u30a4\u30e0\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0\u3001\u50cd\u304d\u65b9\u6539\u9769\u3001\u4ed5\u4e8b\u8853\u306b\u95a2\u9023\u3059\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u6e80\u8f09\uff01\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.timecrowd.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/#\\\/schema\\\/person\\\/d40aa0ec60830d2bb70caa1691f8b60b\",\"name\":\"Kota Miyake\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/miyake_avatar_1504679035-96x96.png\",\"url\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/miyake_avatar_1504679035-96x96.png\",\"contentUrl\":\"https:\\\/\\\/blog.timecrowd.net\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/miyake_avatar_1504679035-96x96.png\",\"caption\":\"Kota Miyake\"},\"url\":\"https:\\\/\\\/blog.timecrowd.net\\\/author\\\/miyake\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b | TimeCrowd Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"ja_JP","og_type":"article","og_title":"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b | TimeCrowd Blog","og_description":"TimeCrowd\u3067\u306f\u62db\u5f85URL\u3092\u767a\u884c\u3057\u3066\u30e1\u30f3\u30d0\u30fc\u3092\u62db\u5f85\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u305d\u306e\u969b\u306b\u76f8\u624b\u306b\u62db\u5f85URL\u3092\u9023\u7d61\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u306b\u9577\u3044\u306e\u3067\u6587\u7ae0...","og_url":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/","og_site_name":"TimeCrowd Blog","article_publisher":"https:\/\/www.facebook.com\/timecrowd\/","article_published_time":"2018-07-11T01:00:30+00:00","og_image":[{"width":1108,"height":600,"url":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-10.33.12.png","type":"image\/png"}],"author":"Kota Miyake","twitter_card":"summary_large_image","twitter_creator":"@TimeCrowd","twitter_site":"@TimeCrowd","twitter_misc":{"\u57f7\u7b46\u8005":"Kota Miyake","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"2\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#article","isPartOf":{"@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/"},"author":{"name":"Kota Miyake","@id":"https:\/\/blog.timecrowd.net\/#\/schema\/person\/d40aa0ec60830d2bb70caa1691f8b60b"},"headline":"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b","datePublished":"2018-07-11T01:00:30+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/"},"wordCount":46,"image":{"@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-10.33.12.png","keywords":["rails","\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0"],"articleSection":["\u958b\u767a"],"inLanguage":"ja"},{"@type":"WebPage","@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/","url":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/","name":"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b | TimeCrowd Blog","isPartOf":{"@id":"https:\/\/blog.timecrowd.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#primaryimage"},"image":{"@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-10.33.12.png","datePublished":"2018-07-11T01:00:30+00:00","author":{"@id":"https:\/\/blog.timecrowd.net\/#\/schema\/person\/d40aa0ec60830d2bb70caa1691f8b60b"},"breadcrumb":{"@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#primaryimage","url":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-10.33.12.png","contentUrl":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2018\/07\/Screen-Shot-2018-07-06-at-10.33.12.png","width":1108,"height":600,"caption":"\u9577\u3044\u62db\u5f85URL\u753b\u50cf"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.timecrowd.net\/generate-shorten-url-by-rails\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/blog.timecrowd.net\/"},{"@type":"ListItem","position":2,"name":"Rails\u3067\u77ed\u7e2eURL\u3092\u767a\u884c\u3059\u308b"}]},{"@type":"WebSite","@id":"https:\/\/blog.timecrowd.net\/#website","url":"https:\/\/blog.timecrowd.net\/","name":"TimeCrowd Blog","description":"\u6642\u9593\u7ba1\u7406\u30c4\u30fc\u30eb\u300cTimeCrowd(\u30bf\u30a4\u30e0\u30af\u30e9\u30a6\u30c9)\u300d\u306e\u30d6\u30ed\u30b0\u3067\u3059\u3002\u30ea\u30e2\u30fc\u30c8\u30ef\u30fc\u30af\u3001\u30c6\u30ec\u30ef\u30fc\u30af\u3001\u30bf\u30a4\u30e0\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0\u3001\u50cd\u304d\u65b9\u6539\u9769\u3001\u4ed5\u4e8b\u8853\u306b\u95a2\u9023\u3059\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u6e80\u8f09\uff01","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.timecrowd.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/blog.timecrowd.net\/#\/schema\/person\/d40aa0ec60830d2bb70caa1691f8b60b","name":"Kota Miyake","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2017\/09\/miyake_avatar_1504679035-96x96.png","url":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2017\/09\/miyake_avatar_1504679035-96x96.png","contentUrl":"https:\/\/blog.timecrowd.net\/wp-content\/uploads\/2017\/09\/miyake_avatar_1504679035-96x96.png","caption":"Kota Miyake"},"url":"https:\/\/blog.timecrowd.net\/author\/miyake\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts\/3302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/comments?post=3302"}],"version-history":[{"count":6,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts\/3302\/revisions"}],"predecessor-version":[{"id":3311,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts\/3302\/revisions\/3311"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/media\/3308"}],"wp:attachment":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/media?parent=3302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/categories?post=3302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/tags?post=3302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}