1
이것은 정말로 나를 괴롭 히고 있습니다. 내 컨트롤러가 정상적으로 작동했지만 네임 스페이스를 변경했으며 경로 또는 문제가있는 것으로 보입니다.NoMethodError in Admin - Nails의 레일스 변경
Showing /home/will/Development/Ruby-Files/tasks/app/views/admin/testos/index.html.erb where line #16 raised:
undefined method `testo_path' for #<#<Class:0xb61ee4f0>:0xaeb2c38>
내 컨트롤러 :
class Admin::TestosController < ApplicationController
# GET /testos
# GET /testos.json
def index
@testos = Testo.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @testos }
end
end
# GET /testos/1
# GET /testos/1.json
def show
@testo = Testo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @testo }
end
end
# GET /testos/new
# GET /testos/new.json
def new
@testo = Testo.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @testo }
end
end
# GET /testos/1/edit
def edit
@testo = Testo.find(params[:id])
end
# POST /testos
# POST /testos.json
def create
@testo = Testo.new(params[:testo])
respond_to do |format|
if @testo.save
format.html { redirect_to @testo, notice: 'Testo was successfully created.' }
format.json { render json: @testo, status: :created, location: @testo }
else
format.html { render action: "new" }
format.json { render json: @testo.errors, status: :unprocessable_entity }
end
end
end
# PUT /testos/1
# PUT /testos/1.json
def update
@testo = Testo.find(params[:id])
respond_to do |format|
if @testo.update_attributes(params[:testo])
format.html { redirect_to @testo, notice: 'Testo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @testo.errors, status: :unprocessable_entity }
end
end
end
# DELETE /testos/1
# DELETE /testos/1.json
def destroy
@testo = Testo.find(params[:id])
@testo.destroy
respond_to do |format|
format.html { redirect_to testos_url }
format.json { head :no_content }
end
end
end
그리고 내보기 파일
목록 나는 레이크 노선에 따라 여전히 아무 소용이 여기
에 오류 경로를 편집이 시도 testos
<table>
<tr>
<th>Title</th>
<th>Entry</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @testos.each do |testo| %>
<tr>
<td><%= testo.title %></td>
<td><%= testo.entry %></td>
<td><%= link_to 'Show', testo %></td>
<td><%= link_to 'Edit', edit_testo_path(testo) %></td>
<td><%= link_to 'Destroy', testo, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Testo', new_testo_path %>
내 라우팅 :
namespace :admin do
resources :testos
end
레이크 경로 :
root / Pages#index
admin_testos GET /admin/testos(.:format) admin/testos#index
POST /admin/testos(.:format) admin/testos#create
new_admin_testo GET /admin/testos/new(.:format) admin/testos#new
edit_admin_testo GET /admin/testos/:id/edit(.:format) admin/testos#edit
admin_testo GET /admin/testos/:id(.:format) admin/testos#show
PUT /admin/testos/:id(.:format) admin/testos#update
DELETE /admin/testos/:id(.:format) admin/testos#destroy
나는, 병이 그것에게주는이 내가 오류입니다 – Melbourne2991
을 한 번 확인하지만 지금 갈 것을하려고 생각 ", : controller =>"admin/testos "}' – Melbourne2991
사과 드려 죄송합니다. 브래킷을 포함하지 않았으므로 경로를 추가해야하는 이유와 (testo) admin_을 추가 할 수는 없습니까? – Melbourne2991