プロダクト開発日誌

技術のことなど

gem

画像アップロード機能を追加(Active Storage)

ユーザモデルに画像を追加します。 bin/rails active_storage:install マイグレーションファイルを確認 class CreateActiveStorageTables < ActiveRecord::Migration[5.2] def change create_table :active_storage_blobs do |t| t.string :key, null: false…

Railsにユーザ認証機能を追加(devise)

install # Flexible authentication solution for Rails with Warden. gem 'devise' bundle install bin/rails g devise:install config/initializers/devise.eb ・・・ Deviseの設定を行うファイル config/locals/devise.en.yml ・・・ Deviseのローカライゼーシ…

RailsのER図を書き出すgem

voormedia.github.io rails-erdを利用するには Graphviz が必要です http://graphviz.org/ sudo port install graphviz Gem をインストール group :development do # Generate Entity-Relationship Diagrams for Rails applications. Read more: http://voor…

Git hooksの導入

github.com git hooksはコミットやマージの前にスクリプトを走らす機能 Hooksの運用に便利なgem overcommitをインストールする group :development do # A fully configurable and extendable Git hook manager # Read more: https://github.com/brigade/ove…

Rails app に Rubocopを導入する

github.com Gemfile group :development do # A Ruby static code analyzer and formatter, based on the community Ruby style guide. https://docs.rubocop.org gem 'rubocop', require: false end bundle install touch .rubocop.yml AllCops: Rails: tru…

annotateでschemeをmodelに書き出す

github.com Gemfile group :development do gem 'annotate' end bundle install 使い方 bundle exec annotate テーブルの情報がコメントで記載されます # == Schema Information # # Table name: areas # # id :bigint(8) not null, primary key # name :str…