これはsubjects_controllerNameError:未定義のローカル変数またはメソッド 'がメインのために:(IRB)からオブジェクト:7
class SubjectsController < ApplicationController
layout false
def index
@subjects = Subject.order("position ASC")
end
def show
@subject = Subject.find(params[:id])
end
def new
end
def edit
end
def delet
end
end
であり、これは 'paramsはshow.html.erb'
<%= link_to("<< Back to List", {:class => 'index'}) :class => 'back- link)'%>
<div class ="subjects show">
<h2>Show Subject</h2>
<table sammary="Subject detail view">
<tr>
<th>Name</th>
<td><%= @subject.name %></td>
</tr>
<tr>
<th>Position</th>
<td><%= @subject.position %> </th>
</tr>
<tr>
<th>Visible</th>
<td><%= @subject.visible ? 'true': 'flse' %> </th>
</tr>
<tr>
<th>Created</th>
<td><%= @subject.created_at %> </th>
</tr>
<tr>
<th>Updated</th>
<td><%= @subject.updated_at %> </th>
</tr>
</table>
</div>
ので、私は、ブラウザ上で何かをクリックしたとき、私は何も得ることはありませんし、私はレールコンソール
Subject.find(params[:id])
にこれをしなかったとき、私はこのmessagを取得しますe
NameError:未定義のローカル変数またはmain(Object)由来のオブジェクト 'params':7
irb/consoleはどのパラメータがわからないためです。 – uday