我正在关注Ryan Bate的教程并收到路由错误。我在这一切都是超级新手,所以我确信这是显而易见的。
我的列表步骤控制器就是这个
class ListingStepsController < ApplicationController
include Wicked::Wizard
steps :building, :space, :ownership, :terms
def show
@property = Property.new(params[:building])
render_wizard
end
def update
@property = Property.new(params[:building])
render_wizard @property
end
端
和我的building.html.erb文件是这个
<%= form_for @property, url: wizard_path do |f| %>
<h1> Tell us about your building </h1>
<div class="form">
<%= f.label :company %><br />
<%= f.text_field :company, autofocus: true, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :description %><br>
<%= f.text_field :description, class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Continue" %>
</div>
<% end %>
我的路线文件就是这个
Rails.application.routes.draw do
resources :spaces
resources :properties
resources :listing_steps
devise_for :users
root 'properties#index'
get 'list' => "pages#list"
get 'reserve' => "pages#reserve"
end
这是我的终端读数:
ActionController::RoutingError (No route matches [POST] "/listing_steps/building"):
actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
web-console (2.1.2) lib/web_console/middleware.rb:37:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.1) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.1) lib/rack/lock.rb:17:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.1) lib/rack/sendfile.rb:113:in `call'
railties (4.2.1) lib/rails/engine.rb:518:in `call'
railties (4.2.1) lib/rails/application.rb:164:in `call'
rack (1.6.1) lib/rack/lock.rb:17:in `call'
rack (1.6.1) lib/rack/content_length.rb:15:in `call'
rack (1.6.1) lib/rack/handler/webrick.rb:89:in `service'
/Users/zak/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/zak/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/zak/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.0ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/routes/_route.html.erb (2.0ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.0ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.1ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (58.5ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/_markup.html.erb (0.4ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.3ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.2ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.2ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/console.js.erb within layouts/javascript (32.4ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/main.js.erb within layouts/javascript (0.3ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.4ms)
Rendered /Users/zak/.rvm/gems/ruby-2.2.1/gems/web-console-2.1.2/lib/web_console/templates/index.html.erb (80.4ms)
感谢您提供任何帮助/建议
答案 0 :(得分:0)
properties_controller.rb
class PropertiesController < ApplicationController
def create
@property = Property.new(property_params)
if @property.save
session[:property_id] = @property.id
redirect_to listing_steps_path
else
render :new
end
end
end