I have the following:
class ArticlesController < ApplicationController
before_action :find_article, only: [:edit, :update, :show, :delete]
def create
@article = Article.new
if @article.save(article_params)
flash[:notice] = "Successfully created article!"
redirect_to article_path(@article)
else
flash[:alert] = "Error creating new article!"
render :new
end
end
private
def article_params
params.require(:article).permit(:title, :body)
end
end
The logs show the form is submitting the values correctly:
Started POST "/articles" for ::1 at 2017-01-01 11:30:13 -0800
Processing by ArticlesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xx==", "article"=>{"title"=>"MAKEMEWORK", "body"=>""}, "commit"=>"Create Article"}
(0.3ms) BEGIN
SQL (0.4ms) INSERT INTO "articles" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2017-01-01 19:30:13.630647"], ["updated_at", "2017-01-01 19:30:13.630647"]]
(0.5ms) COMMIT
Redirected to http://localhost:3000/articles/7
Completed 302 Found in 15ms (ActiveRecord: 4.0ms)
However the title value being submitted as seen in the logs is not being used in the controller. Any idea why?