I'm getting the following error when I'm trying to create a new listing and I can't figure out where is issue is.
ActionController::ParameterMissing in BusinessListingsController#create
param is missing or the value is empty: businesslisting
Below is the code for business_listing_controller:
class BusinessListingsController < ApplicationController
def index
@businesslistings = BusinessListing.all
end
def new
@businesslisting = BusinessListing.new
end
def create
@businesslisting = BusinessListing.new(businesslisting_params)
if @businesslisting.save
redirect_to @businesslisting
else
render 'new'
end
end
def show
@businesslisting = BusinessListing.find(params[:id])
end
private
def businesslisting_params
params.require(:businesslisting).permit(:title, :price, :city, :industry)
end
end
view/business_listing/:
<div class="row">
<div class="col-md-6">
<%= form_for(@businesslisting) do |f| %>
<%= f.label :title %>
<%= f.text_field :title %>
<%= f.label :price %>
<%= f.text_field :price %>
<%= f.label :city %>
<%= f.text_field :city %>
<%= f.label :industry %>
<%= f.text_field :industry %>
<%= f.submit "Create a Listing", class: "btn btn-primary" %>
<% end %>
Thanks!