Ruby on Rails 初心者です。
Windows 8
ruby Ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
コントローラに指定したアクションとは別のアクションが実行されてしまいます。
ブラウザでhogehoge/indexと入力すると
「showだよ」の方が表示されます。
routes.rbには、以下のようにしました。
resources :'hogehoge'
hogehogeコントローラは以下のようにしました。
ruby
1# coding: utf-8 2class HogehogesController < ApplicationController 3 4 #一覧 5 def index 6 @msg= "indexだよ" 7 end 8 9 def show 10 @msg= "showだよ" 11 end 12 13 def new 14 end 15 16 def update 17 end 18 19 20end 21
viewは2つ(index.html.erb、show.html.erb)置いています。
indexを実行させたいのですが・・・・
何が原因でしょうか?
【追記】
hogehoge/ だけだとindexが呼ばれます。
hogehoge/index だとshowが呼ばれました。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/07 05:02