我在使用邪恶的内部命名空间时遇到问题。我有命名空间“合作伙伴”,在这个命名空间中我可以添加汽车,所以我的路线看起来像这样:
namespace :partners do
resources :cars
resources :car_steps
end
我有控制器车:
module Partners
class CarsController < ApplicationController
load_and_authorize_resource
def index
end
def new
end
def create
if @car.save
flash[:notice] = t("cars.created")
redirect_to action: :index
else
render :new
end
end
def show
end
def edit
end
def update
if @car.update(car_params)
flash[:notice] = t("cars.updated")
redirect_to action: :index
else
render :edit
end
end
def destroy
@car.destroy
flash[:error] = t("cars.destroy")
redirect_to action: :index
end
private
def car_params
params.require(:car).permit(:plates, :seats, :doors,
:transmission, :fuel, :air_condition, :radio, :driving_license_min_time,
:min_driver_age, :credit_card, :credit_card_count)
end
end
end
我在这个命名空间中也创建了car_steps_controller.rb:
module Partners
class CarStepsController < ApplicationController
skip_authorization_check
include Wicked::Wizard
steps :payment
def show
render_wizzard
end
end
end
问题出在我访问时:http://localhost:3000/partners/car_steps/payment?
我有错误:
undefined local variable or method `render_wizzard' for #<Partners::CarStepsController:0x007fac9032f5e8>
我不知道我做错了什么。任何人都知道答案
答案 0 :(得分:1)
你有一个错字。
render_wizzard
应该是:
render_wizard