For some reason when I pass in the form data it is saving to the database as nil. I'm using rails 4 and am using strong parameters and everything looks good according to the server but in the end it winds up saving as nil. All help is greatly appreciated, I'm new to rails and this one has me stumped. I also don't currently have any validations in the model trying to get this to work.
Controller Code
def create
@movie = Movie.new(params[movie_params])
if @movie.save
redirect_to @movie
else
flash[:error] = "Didn't save"
render 'new'
end
end
private
def movie_params
params.require(:movie).permit(:title, :rating)
end
Form Code
<%= form_for(@movie) do |f| %>
<%= f.label :title %>
<%= f.text_area :title %>
<%= f.label :rating %>
<%= f.text_area :rating %>
<%= f.submit "Submit" %>
<% end %>