I'm quite new to ruby and I'm trying to put the form to add a new post to the "application.html.erb" page.
Somehow I can't get it to work by just copying the code from the "app/views/things/_form.html.erb" page, and also I can't seem to get it to work by copying the code from the "app/views/things/new.html.erb" page.
If I do that I get the error:
First argument in form cannot contain nil or be empty
<%= form_for(@thing) do |f| %>
I think you should take a look at ruby on rails MVC model first, and also go through a basic tutorial. Just a quick review of you question:
application.html.erb is usually in the
layout folder of rails,
it's job is to provide a root template/layout for the whole project if not specified.
usually you don't want to put any code that is not commonly
needed by all pages.
the reason it is giving you the error
First argument in form cannot contain nil or be empty is because, the helper method
form_for is expecting the controller to provide a
@thing to the view file
application.html.erb, in your case, it is obvious that
@thing is not exist in your controller or your