LoginSignup
0
0

More than 3 years have passed since last update.

自分で作成したRubyのアプリを指定した場所から始まるように設定するには

Posted at

modelやcontrollerを作成しているとして、

例えば、app/views/tweets/indexを最初に表示させたいとして

config/routes.rbに

Rails.application.routes.draw do
 root to: 'tweets#index'
 resources :tweets
end

と記述すれば最初に表示できる。

「root to:」は最初に表示させたいview(今回の場合は、'tweets#index')を指定できる。

「resources :〜」はその後に記述するviewに向けてのルートを作成してくれる。

道路に例えると、「resources」で道を作り、「root to」でその道を選ぶという感じです。

0
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
0
0