Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `simple_form_for' in RoR application

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?

like image 259
Tushar Garg Avatar asked Apr 04 '12 23:04

Tushar Garg


2 Answers

Did you restart your server? Always keep in mind that after you install a gem or plugin. Always restart your server

like image 154
AllenC Avatar answered Sep 23 '22 12:09

AllenC


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!.

like image 38
Prabhakar Undurthi Avatar answered Sep 24 '22 12:09

Prabhakar Undurthi