LoginSignup
1
0

More than 5 years have passed since last update.

railsでプロジェクト内でroot_pathを使う

Last updated at Posted at 2018-06-14

railsでプロジェクトのroot_pathを使いたい時

  • railsコンソールでプロジェクト内の指定のファイルを引数に実行したかったので、調べた
# これで取得出来る
Rails.root
# プロジェクト内のファイルのpathと結合する
Rails.root.join("app/model/target_model.rb")
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0