{"id":15151492,"url":"https://github.com/naohito-t/neams-api","last_synced_at":"2026-01-19T22:31:54.887Z","repository":{"id":44320776,"uuid":"446002158","full_name":"naohito-T/Neams-api","owner":"naohito-T","description":"rails6 api mode","archived":false,"fork":false,"pushed_at":"2022-02-10T14:38:36.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-07T09:43:06.689Z","etag":null,"topics":["api","docker","rails6","ruby","stripe"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naohito-T.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-09T05:28:54.000Z","updated_at":"2022-02-10T14:37:25.000Z","dependencies_parsed_at":"2022-08-30T16:43:01.949Z","dependency_job_id":null,"html_url":"https://github.com/naohito-T/Neams-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naohito-T%2FNeams-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naohito-T%2FNeams-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naohito-T%2FNeams-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naohito-T%2FNeams-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naohito-T","download_url":"https://codeload.github.com/naohito-T/Neams-api/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247631263,"owners_count":20970037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","docker","rails6","ruby","stripe"],"created_at":"2024-09-26T15:03:48.376Z","updated_at":"2026-01-19T22:31:54.861Z","avatar_url":"https://github.com/naohito-T.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intorduction\n\n開発環境での作成はrootディレクトリのREADME.mdを参照してください。\n\n[README](../README.md)\n\n## Herokuに設定する環境変数\n\nDockerを使わないRailsデプロイでは、以下の環境変数が自動で設定される。\n\n- LANG: en_US.UTF-8（ランゲージ）\n\n- RACK_ENV: production（ラックエンブ）\nRackへ現在の環境を示す変数\nRackとは … http送受信処理を担当するモジュールのこと。\n\n- RAILS_ENV: production（レイルズ エンブ）\nRailsへ現在の環境を示す変数\n\n- RAILS_LOG_TO_STDOUT: enabled（ログ スタンダート アウト）\nlogを標準で出力するか否かのフラグ。enabled = 出力する。\n\n- RAILS_SERVE_STATIC_FILES: enabled（サーバー スタティック ファイルズ）\npublicディレクトリからの静的ファイルを提供してもらう（apiモードではあんま意味ないかも）\nDocker経由の場合は、自分で本番用の環境変数を設定する必要がある。\n\nLANGについては既にDockerfileで定義しているため、その他の環境変数をconfigに定義しています。\n\n## How To deploy ?\n\n$ tree -L 1\n.\n|-- Dockerfile\n|-- Gemfile\n|-- Gemfile.lock\n|-- Makefile\n|-- README.md\n|-- Rakefile\n|-- api\n|-- app\n|   |-- model Controlleから渡させる。\n|-- bin\n|-- config\n|-- config.ru\n|-- db\n|-- entrypoint.sh\n|-- heroku.yml\n|-- lefthook.yml\n|-- lib\n|-- log\n|-- public\n|-- storage\n|-- test\n|-- tmp\n|-- .irbrc Rubyコンソールを実行する $libコマンド実行時に読み込まれる設定ファイル(Railsコンソール起動時にも読み込まれる)\n`-- vendor\n\n## db/migrate/*\n\nマイグレーションファイルはテーブルの中身のカラムを作成するファイル\n\n- マイグレーションファイル命名規則\n\ntableを作成するやつ\ncreate_tablename\ncolumnを変更するやつ\nchange_tablename\n\n## validation 設定確認\n\n[参考](https://blog.cloud-acct.com/posts/u-rails-error-messages-jayml)\n\n```sh\n# api rails console へlogin\n$ make api.console\n# I18n.t(\"パス\") ... 引数のパスで指定したymlファイルの値を返す。\n$ I18n.t(\"activerecord.attributes.user\")\n=\u003e {:name=\u003e\"名前\", :email=\u003e\"メールアドレス\", :password=\u003e\"パスワード\", :activated=\u003e\"アクティブフラグ\", :admin=\u003e\"管理者\"}\n```\n\n## debug確認(binding.pry)\n\n[参考](https://blog.cloud-acct.com/posts/u-rails-custom-eachvalidator)\n\n止めたいコードのところでbinding.pryをするとコードが実行された時に止まる。\n\n```ruby\ndef validate_each(record, attribute, value)\n  # debug\n  binding.pry # ここで止まる\nend\n```\n\n- record\nユーザオブジェクト\n\n- attribute\n属性が入る。エラーメッセージにも使われる\n\n- value\nユーザが入力した値が入る\n\n## クラス宣言について\n\nZeitwerkの仕様に合ったクラスの宣言を\nRails6から導入されたオートロードシステムの「Zeitwerk（ツァイトベルク）」の仕様で、ファイルパスと一致するクラスを宣言しないと正しく読み込まれません。\n\nつまり、\n\n「servicers」以下のファイルパス =\u003e「user_auth/auth_token.rb」と\nクラスの宣言 =\u003e UserAuth::AuthToken を一致させる必要。\n\n何も継承しないクラスを宣言する場合は、\n\n「services」ディレクトリ直下にauth_token.rbを作成し、\nその中でAuthTokenクラスを宣言すればOK\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaohito-t%2Fneams-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaohito-t%2Fneams-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaohito-t%2Fneams-api/lists"}