undefined method `simple_form_for' in RoR application

Go To StackoverFlow.com

26

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?

2012-04-04 23:17
by Tushar Garg
did you restart server after install simple_form gem - Vasiliy Ermolovich 2012-04-05 05:35
doh! of course. I knew it was something silly like that. Thanks - Tushar Garg 2012-04-05 14:07


52

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

2013-04-11 03:16
by Allen Chun


6

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

2014-12-13 12:53
by Prabhakar
Ads