알았어, 여기 간다!이상한 오류 : AbstractController :: ActionNotFound - Ruby on Rails
오류 :
AbstractController::ActionNotFound at /venues/1 The action 'update' could not be found for VenuesController
나는 또한 VenuesController에서 액션 '파괴'이 오류를 받고 있어요.
동일하게 보이는 내 GamesController의 업데이트/파괴 문제의 정확한 세트.
경로 :
Rails.application.routes.draw do
devise_for :users
resources :events
resources :venues
resources :games
get "profiles/:id" => "profiles#show", as: :profile
get "profiles" => "profiles#index"
get "calendar" => 'profiles#calendar'
root 'welcome#index'
get 'about' => 'welcome#about'
get 'contact' => 'welcome#contact'
end
내 VenuesController은 다음과 같습니다
class VenuesController < ApplicationController
before_action :set_venue, only: [:show, :edit, :update, :destroy]
def new
@venue = Venue.new
end
def show
end
def index
@v = Venue.all
end
def edit
end
def create
@venue = Venue.new(venue_params)
respond_to do |format|
if @venue.save
format.html { redirect_to @venue, notice: 'Venue was successfully created.' }
else
format.html { render :new }
end
end
end
end
def update
respond_to do |format|
if @venue.update(venue_params)
format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }
else
format.html { render :edit }
end
end
end
def destroy
@venue.destroy
respond_to do |format|
format.html { redirect_to venues_url, notice: 'Venue was successfully destroyed.' }
end
end
private
def venue_params
params.require(:venue).permit(:name, :address, :phone, :website, :venues_type)
end
def set_venue
@venue = Venue.find(params[:id])
end
내 장소보기 _form.html.erb :
<%= form_for(@venue) do |f| %>
<% if @venue.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@venue.errors.count, "error") %> prohibited this venue from being saved:</h2>
<ul>
<% @venue.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :address %><br>
<%= f.text_field :address %>
</div>
<div class="field">
<%= f.label :website %><br>
<%= f.text_field :website %>
</div>
<div class="field">
<%= f.label :venues_type %><br>
<%= f.text_field :venues_type %>
</div>
<div class="field">
<%= f.label :phone %><br>
<%= f.text_field :phone, placeholder: "xxx-xxx-xxxx" %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
그리고 내 스택 :
Started PATCH "/venues/1" for ::1 at 2016-10-26 11:49:36 -0400
AbstractController::ActionNotFound - The action 'update' could not be found for VenuesController: actionpack (5.0.0.1) lib/abstract_controller/base.rb:121:in
process' actionview (5.0.0.1) lib/action_view/rendering.rb:30:in
process' actionpack (5.0.0.1) lib/action_controller/metal.rb:190:indispatch'
dispatch' actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in
actionpack (5.0.0.1) lib/action_controller/metal.rb:262:indispatch' actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in
serve' actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:inblock in serve' actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in
each' actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:inserve' actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in
call'
warden (1.2.6) lib/warden/manager.rb:35:inblock in call' warden (1.2.6) lib/warden/manager.rb:34:in
catch' warden (1.2.6) lib/warden/manager.rb:34:incall' rack (2.0.1) lib/rack/etag.rb:25:in
call' rack (2.0.1) lib/rack/conditional_get.rb:38:incall' rack (2.0.1) lib/rack/head.rb:12:in
call' rack (2.0.1) lib/rack/session/abstract/id.rb:222:incontext' rack (2.0.1) lib/rack/session/abstract/id.rb:216:in
call' actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:incall' activerecord (5.0.0.1) lib/active_record/migration.rb:552:in
call' actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:inblock in call' activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in
run_callbacks' activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in_run_call_callbacks'
run_callbacks' actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:incall' actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in
call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:incall' better_errors (2.1.1) lib/better_errors/middleware.rb:84:in
protected_app_call' better_errors (2.1.1) lib/better_errors/middleware.rb:79:inbetter_errors_call'
call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in
actionpack (5.0.0.1)
lib/action_dispatch/middleware/debug_exceptions.rb:49:incall'
call_app'
web-console (3.3.1) lib/web_console/middleware.rb:131:in
web-console (3.3.1) lib/web_console/middleware.rb:28:inblock in call' web-console (3.3.1) lib/web_console/middleware.rb:18:in
catch' web-console (3.3.1) lib/web_console/middleware.rb:18:incall' actionpack (5.0.0.1)
call'
lib/action_dispatch/middleware/show_exceptions.rb:31:in
railties (5.0.0.1) lib/rails/rack/logger.rb:36:incall_app'
block in call'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:inblock in tagged' activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in
tagged' activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:intagged'
call'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:incall' actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in
call' rack (2.0.1) lib/rack/method_override.rb:22:incall' rack (2.0.1) lib/rack/runtime.rb:22:in
call' activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall' actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in
call' actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:incall'
call' railties (5.0.0.1) lib/rails/engine.rb:522:in
rack (2.0.1) lib/rack/sendfile.rb:111:incall' puma (3.6.0) lib/puma/configuration.rb:225:in
call' puma (3.6.0) lib/puma/server.rb:578:inhandle_request' puma (3.6.0) lib/puma/server.rb:415:in
process_client' puma (3.6.0) lib/puma/server.rb:275:inblock in run' puma (3.6.0) lib/puma/thread_pool.rb:116:in
call' puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'Started POST "/__better_errors/0c664909e8d5ec43/variables" for ::1 at 2016-10-26 11:49:36 -0400
나는 완전히 뒤죽박죽이다 - 어떤 아이디어/입력이든 대단히 감사한다! 감사!
정말 고마워요! 나는 미쳤다고 느꼈다! –
당신은 환영합니다 :) – kriskova