{"id":1341,"date":"2021-12-25T19:57:10","date_gmt":"2021-12-25T10:57:10","guid":{"rendered":"https:\/\/suzutukiblog.com\/?p=1341"},"modified":"2022-01-23T08:13:27","modified_gmt":"2022-01-22T23:13:27","slug":"rails","status":"publish","type":"post","link":"https:\/\/suzutukiblog.com\/index.php\/2021\/12\/25\/rails\/","title":{"rendered":"Rails\u306egem\u300cannotate\u300d\u306e\u4f7f\u3044\u65b9(Docker\u74b0\u5883)"},"content":{"rendered":"<h2>annotate\u3068\u306f\uff1f<\/h2>\n<p>\u30e2\u30c7\u30eb\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b9\u30ad\u30fc\u30de\u69cb\u9020\u3092<strong>annotate(\u6ce8\u91c8)<\/strong>\u3057\u3066\u304f\u308c\u308bGem<\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u6642\u306bDB\u306b\u6f5c\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\u3088\u3002<\/p>\n<h3>Docker\u3067\u306e\u4f7f\u3044\u65b9<\/h3>\n<p>Gemfile\u306egroup :development do\u306b<\/p>\n<pre><strong>gem 'annotate'<\/strong><\/pre>\n<p>\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p>docker-compose down\u3000\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664<\/p>\n<p>docker-compose build \u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u308a\u76f4\u3057<\/p>\n<p>docker-compose up -d\u3067\u8d77\u52d5\u3057\u3066\u304b\u3089\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u3059\u308b<\/p>\n<pre><code>docker-compose exec web bundle exec annotate <\/code><\/pre>\n<p>\u5909\u308f\u3089\u306a\u304b\u3063\u305f\u3068\u304d\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u3059\u308b\u3002<\/p>\n<pre><code>docker-compose exec web bundle exec rails g annotate:install<\/code><\/pre>\n<p>(\u6b21\u56de\u306e\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u4ee5\u964d\u3001\u81ea\u52d5\u3067\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3057\u3066\u304f\u308c\u308b\u30b3\u30de\u30f3\u30c9)<\/p>\n<p>\u3082\u3046\u4e00\u5ea6\u2193\u3092\u30b3\u30de\u30f3\u30c9<\/p>\n<pre><code>docker-compose exec web bundle exec annotate<\/code><\/pre>\n<p>Annotated (7): app\/models\/task.rb, test\/models\/task_test.rb, test\/fixtures\/tasks.yml, test\/fixtures\/tasks.yml, app\/models\/user.rb, test\/models\/user_test.rb, test\/fixtures\/users.yml<\/p>\n<p>\u2191\u306e\u3088\u3046\u306bAnnoteted\u3068\u306a\u3063\u3066\u3044\u308c\u3070\u6210\u529f\u3057\u3066\u3044\u3066\u3001\u6b21\u306e\u3088\u3046\u306b<\/p>\n<p>\u4f8b:<strong>app\/models\/user.rb<\/strong><\/p>\n<pre># == Schema Information\r\n#\r\n# Table name: users\r\n#\r\n#  id              :bigint           not null, primary key\r\n#  admin           :boolean          default(FALSE)\r\n#  email           :string(255)\r\n#  name            :string(255)\r\n#  password_digest :string(255)\r\n#  remember_digest :string(255)\r\n#  created_at      :datetime         not null\r\n#  updated_at      :datetime         not null\r\n#\r\n# Indexes\r\n#\r\n#  index_users_on_email  (email) UNIQUE\r\n#\r\nclass User &lt; ApplicationRecord\r\n  has_many :tasks, dependent: :destroy\r\n  attr_accessor :remember_token\r\n  before_save { email.downcase! }\r\n  validates :name, presence: true, length: {maximum: 15}\r\n  VALID_EMAIL_REGEX = \/\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z\/i\r\n  validates :email, presence: true, length: {maximum: 100},\r\n            format: {with: VALID_EMAIL_REGEX},\r\n            uniqueness: {case_sensitive: false}\r\n  has_secure_password\r\n  validates :password, presence: true, length: {minimum: 5}, allow_nil: true\r\n\r\n<\/pre>\n<p># == Schema Information\u304b\u3089\u59cb\u307e\u308b\u30c6\u30fc\u30d6\u30eb\u60c5\u5831\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308c\u3070OK\u3060\u3088<\/p>\n","protected":false},"excerpt":{"rendered":"<p>annotate\u3068\u306f\uff1f \u30e2\u30c7\u30eb\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b9\u30ad\u30fc\u30de\u69cb\u9020\u3092annotate(\u6ce8\u91c8)\u3057\u3066\u304f\u308c\u308bGem \u30c6\u30fc\u30d6\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u6642\u306bDB\u306b\u6f5c\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\u3088\u3002 Docker\u3067\u306e\u4f7f\u3044\u65b9 Gemfile\u306egroup :develo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[23,27,13],"tags":[],"class_list":["post-1341","post","type-post","status-publish","format-standard","hentry","category-docker","category-programming-note","category-rails"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/1341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=1341"}],"version-history":[{"count":9,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/1341\/revisions"}],"predecessor-version":[{"id":4603,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/1341\/revisions\/4603"}],"wp:attachment":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=1341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=1341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=1341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}