Zoltán
Zoltán

Reputation: 22166

Rails installation can't find active_model

I created a fresh project using rails new Project -d=postgresql. If I then run rails server, I get the following error message:

C:/GemRepository/gems/actionpack-3.1.3/lib/action_dispatch.rb:34:in `require': cannot load such file -- active_model (LoadError)
    from C:/GemRepository/gems/actionpack-3.1.3/lib/action_dispatch.rb:34:in `<top (required)>'
    from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands/server.rb:3:in `require'
    from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands/server.rb:3:in `<top (required)>'
    from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands.rb:48:in `require'
    from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands.rb:48:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I also tried

gem which active_model

which returned

C:/GemRepository/gems/activemodel-3.1.1/lib/active_model.rb

Please help me.

Upvotes: 0

Views: 2441

Answers (6)

Jonathan
Jonathan

Reputation: 11494

I had a similar error and it was due to accidentally corrupting my Gemfile, so it is worth checking that. If it is version controlled then just git checkout Gemfile and bundle update to rebuild.

Upvotes: 0

user3965493
user3965493

Reputation: 1

gem uninstall active-model and perfomr gem install active-model

Upvotes: -1

paf0
paf0

Reputation: 130

Had this problem, came across this post. This fixed it for me:

rvm gemset pristine

Upvotes: 2

Zolt&#225;n
Zolt&#225;n

Reputation: 22166

Well, I managed to solve it.

I restarted my computer, deleted everything from my gem repository, reinstalled rubygems (ruby setup.rb) and reinstalled rails (gem install rails).

Thanks anyway :)

Upvotes: 1

sethvargo
sethvargo

Reputation: 26997

Run the bundle command from the project directory

Upvotes: 0

Adrian
Adrian

Reputation: 734

What version of rails is in the gem file? And have you run 'bundle install'?

I notice that Actionpack is 3.1.3 is called by the server, but the activemodel found is 3.1.1.

Upvotes: 0

Related Questions