I'm getting the error:
undefined form_with for #<#<Class:0x7ac62e0>:0x551e5a8>
in articles#new
The error occurs in the following file: new.html.erb
Which has:
<%= form_with(model: [@article] , local: true) do |f| %>
<p>
<%= f.label :title %><enter code here`br>
<%= f.text_field :title %>
</p>
And the controller articles_controller.rb
has:
class ArticlesController < ApplicationController
def new
end
end
your controller just has new command see sample below for create instance variable @article
articles_controller.rb
class ArticlesController < ApplicationController
def new
@article = Article.new
end
end
new.html.erb
<%= form_with @article do |f| %>
<%= f.label "Enter title: " %>
<%= f.text_field :title %>
<% end %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With