undefined method `orders_path' for #<#<Class:0x000056000dc5cea8>:0x00007f89c40e73d8>

Hi Alex i'm getting this error when i'm trying to get inside order/new my _form pake looks fine <%= form_for([@competition, @order]) do |form| %> and routes to resources :competitions do resources :orders end please help best regards Boaz

Posted over 1 year ago by boaz
Posted over 1 year ago by boaz

now I'm getting this error " undefined method `id' for nil:NilClass" when i'm trying to crate a order
this is my controller:
def create
@order = Order.new(order_params)
@order = Competition.find(params[:competition_id])

@order.competition_id = @competition.id
@order.buyer_id = current_user.id

respond_to do |format|
if @order.save
format.html { redirect_to @order, notice: 'Order was successfully created.' }
format.json { render :show, status: :created, location: @order }
format.html { render :new }
format.json { render json: @order.errors, status: :unprocessable_entity }

please help me

Posted over 1 year ago by boaz

sorry i just replace a word in order controller
so everything is great
thank you