I have created a ToDoList based off Hartl's tutorial, and following a guide to add a tagging system. I have followed till Section 10, where they asked me to modify my new.html.erb file to the code as shown on the source.
<div class = 'col-md-8 offset-2'>
<h1 class = "text-center">New Blog Post</h1>
<%= simple_form_for @post, url: posts_path do |f| %>
<%= f.input :title %>
<%= f.input :content %>
<%= f.input :tag_ids, as: :select, collection: Tag.order(:name), label_method: :name, input_html: {multiple: true} %>
<%= f.submit "Next", class: 'btn btn-lg btn-primary float-right' %>
<% end %>
</div>
Since my ToDoList displays the tasks on the static_pages, I improvised and changed micropost_form.html.erb instead.
Before change:
<%= form_for(@micropost) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<div class="field">
<%= f.text_area :content, placeholder: "Add new task..." %>
</div>
<%= f.submit "Add Task", class: "btn btn-primary" %>
<% end %>
After change:
<%= simple_form_for @micropost, url: microposts_path do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<div class="field">
<%= f.text_area :content, placeholder: "Add new task..." %>
<%= f.input :tag_ids, as: :select, collection: Tag.order(:name), label_method: :name, input_html: {multiple: true} %>
</div>
<%= f.submit "Add Task", class: "btn btn-primary" %>
<% end %>
This produced the error.
NoMethodError in StaticPages#home
undefined method `simple_form_for' for #<#<Class:0x00007f8d6c84d4f0>:0x00007f8d6c833230>
Did you mean? simple_format
Can anyone suggest what might be wrong here? Please let me know if more information is needed.
The most common solution to resolve problem like this, is restart the server. You should always do this after install gem. Have you tried this?
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