I've been browsing stack overflow and I noticed that many people use simple_form to make their lives easier.
I wanted to give it a try, so I added the gem to my gem file (gem 'simple_form'
) and sent:
rails generate simple_form:install --bootstrap
After reading the installation message, I created a view with the sample code from the readme:
<%= simple_form_for @user do |f| %> <%= f.input :username %> <%= f.input :password %> <%= f.button :submit %> <% end %>
Unfortunately, I get this error as soon as I try to load the page:
undefined method `simple_form_for' for #<#<Class:0x69dd688>:0x6903ac8>
What gives? How come it can't even recognize the method? I feel like I'm missing something really simply here. Could it be because i'm using bootstrap-sass? Do I need to include a helper in my user controller?
Did you restart your server? Always keep in mind that after you install a gem or plugin. Always restart your server
Its all because you didn't restart your server after installing new libraries such as simple_form, devise etc.
Try stop your server and restart it. Your code is perfect!. I encountered this several times. The solution is just restarting the server!.
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