Rails 5.0 Error: ActiveModel::ForbiddenAttributesError
<p>I'm attempting to make a blog post on my web-app updatable from the browser, but when I click update in the edit for, I get this error:
ActiveModel::ForbiddenAttributesError</p>

<p>error in pots_controller line 33:    </p>

<p>if @post.update_attributes(params[:post])      </p>

<p>this is my edit.html.erb code:</p>

<pre><code>&lt;h1&gt;Edit Post&lt;/h1&gt;
&lt;%= form_for @post do |f| %&gt;
    &lt;p&gt;
        &lt;%= f.label :title %&gt;&lt;br /&gt;
        &lt;%= f.text_field :title %&gt;&lt;br /&gt;
    &lt;/p&gt;
    &lt;p&gt;
        &lt;%= f.label :body %&gt;&lt;br /&gt;
        &lt;%= f.text_field :body %&gt;&lt;br /&gt;
    &lt;/p&gt;
    &lt;p&gt;
        &lt;%= f.select :category_id, Category.all.collect {|x| [x.name, x.id]}, {:include_blank =&gt; "Select One"} %&gt;&lt;br /&gt;
    &lt;/p&gt;
    &lt;p&gt;
        &lt;%= f.submit "Update post" %&gt;
    &lt;/p&gt;
&lt;% end %&gt;
&lt;%= link_to "Go Back", post_path %&gt;
</code></pre>

<p>this is my posts_controller.rb code:</p>

<pre><code>class PostsController &lt; ApplicationController
    def index
        @posts = Post.find(4,5)
    end

    def show
        @post = Post.find(params[:id])
    end

    def new
        @post = Post.new
        @category = Category.all

    end

    def create
        @post = Post.new(params[:post])
        if @post.save
            redirect_to posts_path, :notice =&gt; "Your post has been saved"
        else
            render "new"
        end

    end

    def edit
        @post = Post.find(params[:id])

    end

    def update
        @post = Post.find(params[:id])
        if @post.update_attributes(params[:post])           
            redirect_to post_path, :notice =&gt; "Your post has been updated"
        else 
            render "edit"
        end 

    end

    def destroy
        @post = Post.find(params[:id])
        @post.destroy
        redirect_to posts_path, :notice =&gt; "Your post has been deleted"
    end

end
</code></pre>

<p>hope and thank anyone can help. Best, M</p>