2015-06-04 64 views
0

我跟隨瑞安貝特的教程,並得到一個路由錯誤。我在這一切都超級新,所以我相信這是顯而易見的。使用邪惡的寶石時路由錯誤

我列出步驟的控制器是這樣

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

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 
+0

@zkidd是這方面的工作? –

+0

看起來不像。我仍然得到這個: 沒有路線匹配[POST]「/ listing_steps/building」 – zkidd

相關問題