Ruby

Ruby

Railsで改行も反映した状態で文章を表示するには?

simple_formatと最初につけて表示させる <%=simple_format@recipe.body%>

Read More

Ruby

Ruby

Railsで更新日を日本時間で取得するにはどうしたら良いか

まず以下に利用するタイムゾーンの設定をする config/application.rb module Recipegram class Application < Rails::Application ・・・・ c […]

Read More

Ruby

Ruby on Rails のgem、Deviseで任意の項目も登録できるようにするには?

RailsのApplicationControllerにdeviseに関するストロングパラメーターを記述します class ApplicationController < ActionController::Bas […]

Read More

Ruby

Ruby on Rails でformにClassを追加する場合の書き方

<%= f.password_field :password, autocomplete: “new-password”, class: “form-control” %> カンマ区切りでそのままclassを […]

Read More

Ruby

Ruby のアンインストールをするには

Rubyがインストールされている場所を確認します $which ruby  /Users/ユーザー名/.rbenv/shims/ruby ←基本的にここになるはず 削除をします $rbenv uninstall バージョ […]

Read More

Ruby

Rubyのバージョンをmacでアップデートする

まずrbenvがインストールされていることを確認する $rbenv 次にインストール可能なRubyバージョンを確認する $rbenv install -l Rubyをインストールする $rbenv install 2.7 […]

Read More