# Rails engine not finding controller every second page load

**URL:** <https://www.ruby-forum.com/t/rails-engine-not-finding-controller-every-second-page-load/205352>\
**Category:** Engines\
**Created:** [April 5, 2011, 2:52am UTC](https://www.ruby-forum.com/t/rails-engine-not-finding-controller-every-second-page-load/205352 "2011-04-05T02:52:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 5, 2011, 2:52am UTC](https://www.ruby-forum.com/t/rails-engine-not-finding-controller-every-second-page-load/205352/1 "2011-04-05T02:52:34Z")

</div>

Hi,  
i’m developing a rails 3 engine but really having troubles getting the  
controller to load every time.

every second time I visit the page I get;  
LoadError in Webedit/public filesController#index

Expected  
/home/anko/.rvm/gems/ruby-1.9.2-p136/bundler/gems/webedit-3e02394235c3/app/controllers/public\_files\_controller.rb  
to define PublicFilesController

to reproduce (assuming bash, ruby 1.9.2 and rails 3);

rails new webedit-test  
cd webedit-test  
echo “gem ‘webedit’, :git =\>  
‘[GitHub - ankopainting/webedit: webedit rails 3 engine](https://github.com/ankopainting/webedit.git)’, :tag =\> ‘v0.0.3’” \>\>  
Gemfile  
bundle install  
rails server

then goto [http://localhost:3000/public](http://localhost:3000/public)

it will either say “hi” or an error… refresh to see it change to the  
opposite behaviour.

any help would be greatly appreciated… I’ve spent some time in ruby  
debugger but need to understand a lot about how rails works to get a  
meaningful result.
