Ruby on Rails
Zoneモデルを作成し、AreaモデルとZoneモデルを1対多のリレーションを作成します。 Zoneモデルの作成 bin/rails g scaffold Zone name:string description:text Migration File class CreateZones < ActiveRecord::Migration[6.0] def change create_table :…
ユーザモデルに画像を追加します。 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…
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のローカライゼーシ…
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…
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…
bundler.io Install可能なバージョンを指定 gem search ^bundler$ --all バージョンを指定してインストール gem install bundler -v 2.0.1 インストール済みのバージョン gem list bundler バージョンを指定して実行 bundle _2.0.1_ install
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…
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…
今回はacrive__hashを利用して、Area Model に都道府県情報を付与します。 github.com install # A readonly ActiveRecord-esque base class that lets you use a hash, a Yaml file or a custom file as the datasource. Read more: https://github.com/zil…
Better Errors 標準のRailsエラーページを遥かに優れたエラーページに置き換えます。 github.com Binding of caller Better Errors のエラー画面でirbを利用できるようになる。 github.com Pry byebug 段階的なデバッグ機能とスタックナビゲーション機能を追…
今回はエリアモデルを作成します。 bin/rails generate scaffold Area name:string description:string https://railsguides.jp/command_line.html#rails-generate nameは必須にします。 class CreateAreas < ActiveRecord::Migration[6.0] def change creat…
github.com github.com Gemfile gem 'slim-rails' gem 'html2slim' gem をInstall bundle install --path vendor/bundle --jobs=4 erbをslimに変換 bundle exec erb2slim app/views/layouts/ --delete
rails のInstall bundle init rails のgemを追加 # Gemfile + gem 'rails', github: 'rails/rails' github.com rails をInstall bundle install --path vendor/bundle --jobs=4 rails のバージョンを確認 bundle exec rails -v Rails 6.0.0.beta3 新アプリの…
Haml (HTML Abstraction Markup Lunguage) 概要 HTML template engin HTMLをスッキリ美しく 公式サイト: http://haml.info/ リファレンス: http://haml.info/docs/yardoc/file.REFERENCE.html コツ h1, tableなどは開始タグと閉じタグを削除し、%をタグにつ…
エラー URLはブロックされています: リダイレクトURIがアプリのクライアントOAuth設定でホワイトリストに追加されていないため、リダイレクトできませんでした。クライアントとウェブOAuthログインをオンにして、すべてのアプリドメインを有効なOAuthリダイ…