Robert
Robert

Reputation: 11

uninitialized constant Formtastic::SemanticFormBuilder (NameError) when starting rails server

I was trying to start my rails server, but I am getting the following error:

/config/initializers/formtastic.rb:27:in `': uninitialized constant Formtastic::SemanticFormBuilder (NameError)

The only thing I can remember what I did last was a bundle install, and since then it hasn't been working. I have tried removing and reinstalling my gems, even the formtastic gem. When I do remove the formtastic gem from my gemfile i get the following error:

/config/initializers/formtastic.rb:27:in `': uninitialized constant Formtastic (NameError)

I then went to comment that formtastic.rb to see what is going on, and when I tried to start the server I then got another error, from another one of my files:

/app/api/V1/base_api.rb:11:in inherited': undefined methodinherit' for API::V1::ShoppingListAPI:Class (NoMethodError)

Whatever I do, another name error comes up. Not sure what is going on and how to debug this. I have tried to search the internet and have found no solutions to this. Wondering if someone has uncovered the same problem.

Upvotes: 1

Views: 2653

Answers (3)

Phillipp
Phillipp

Reputation: 264

Nope, that's not the problem. SemanticFormBuilder has been renamed to FormBuilder as of version 2.

Upvotes: 12

dayanthan
dayanthan

Reputation: 31

If you create formatastic.rb in your initializers you got this error if you don't need that file remove it and run.
The path is:

Configuration/Initializers/formtastic.rb

Upvotes: 3

YogiZoli
YogiZoli

Reputation: 890

This seems a Gem dependency problem. When you did "bundle install" you've probably installed another Gem version you used earlier.

I highly recommend you to use RVM and create Gemsets to avoid and prevent Gem dependency issues: https://rvm.io/

Also you may want to check out your Gemfile and Gemfile.lock to see how they works (checkout Railscasts for more info). I think removing that Gem is not a really good idea, probably better if you reinstall it. Also removing that file isn't really helpful. Try to solve this with RVM and installing right gems and you'll be good to go.

Upvotes: 0

Related Questions