Take the 2-minute tour ×

I'm getting this odd error, as if SimpleForm isn't even installed:

undefined method `simple_form_for'

SimpleForm IS in my gemfile and I've installed:

Using simple_form (2.0.2)

I'm running on the Pow server, so it's restarting every time.

class admin::EventsController < ApplicationController
  def new
    @event = Event.new

class Event
  include Mongoid::Document
  field :summary
  field :start_date
  field :end_date

= simple_form_for [:admin, @event] do |f|
  = f.input :summary
  = f.input :start_date
  = f.input :end_date

Any ideas why it seems like SimpleForm isn't even installed?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Did you run the generator after you installed the gem? In your console you need to run this:

rails generate simple_form:install
share|improve this answer
Yeah I ran this command as well.. –  ksweet Sep 27 '12 at 23:30
If you look at the gem documentation, simple_form depends on Active Record. For instance here, github.com/plataformatec/simple_form/blob/master/lib/…. Maybe try something else if you are using Mongoid. –  shicholas Sep 28 '12 at 1:00
yeah you're definitely right, but I don't know if that's the actual problem here, because I think the basic functionality still works between the two. Anyway, I somehow got this to work, and I don't know how. All of these files look exactly the same. I was switching between another branch making scaffolds trying to get back to the basics, and when I switched back to this branch it just worked. Maybe some random config somewhere was screwing things up? At least I didn't pull all my hair out. –  ksweet Sep 28 '12 at 15:55

I tried the command: rails generate simple_form:install

And - it didn't run. Instead the output looked like I gave rails an ill-formed command line and it gave back a copy of the usage file.

Then, within RubyMine, I tried it again - this time got an error traceback - first line is shown below:

/home/user1/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/generators/base.rb:265:in `const_defined?': wrong constant name SimpleForm:installGenerator 

After commenting out the lines 265-269 in base.rb:

#  if last && last.const_defined?(last_name.camelize, false)
#     raise Error, "The name '#{class_name}' is either already used in your application " <<
#            "or reserved by Ruby on Rails. Please choose an alternative and run "  <<
#            "this generator again."
#  end

and running the command again, I got:

/home/user1/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/user1/RubymineProjects/TravelAid/bin/rails generate generator simple_form:install -s
      create  lib/generators/simple_form:install
      create  lib/generators/simple_form:install/simple_form:install_generator.rb
      create  lib/generators/simple_form:install/USAGE
      create  lib/generators/simple_form:install/templates

Process finished with exit code 0

This looks pretty good, but I haven't gone back to check if simple_form works yet.

Under lib/generators, I have:

  simple_form.install_generator.rb  (created about 18 minutes ago - consistent with new)

I am running Rails 4.0.0 and ruby-2.0.0-p247 within Rubymine

share|improve this answer

Your Answer


