I try to do a simple create using rails 4
my controller:
class AdsController < ApplicationController
  def new
    @ad = Ad.new
  end
  def create
    @ad = Ad.new(params[:ad])    
    @ad.save
  end
  def show
    @ad = Ad.find(params[:id])
  end
  def index
    @ads = Ad.first(3)
  end
  private
  def ad_params    
    params.require(:ad).permit(:title, :price, :description)
  end
end
form:
<%= form_for @ad do |p| %>
  <p><%= p.text_field :title %></p>
  <p><%= p.text_field :price %></p>
  <p><%= p.text_area :description %></p>
  <p><%= p.submit %></p>
<% end %>
from my point of view it's ok but I got this error ActiveModel::ForbiddenAttributesError
what I'm doing wrong?
UPDATE:
my problem was passing wrong value to new method in create action: the solution was to pass ad_params to it
 
     
     
     
     
     
    