开发者

My rails 3 engine's controller is only found by rails every second page refresh, otherwise returns LoadError

开发者 https://www.devze.com 2023-02-22 14:25 出处:网络
i\'m developing a rails 3 engine 开发者_C百科but really having troubles getting the controller to load every time.

i'm developing a rails 3 engine 开发者_C百科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 => 'https://github.com/ankopainting/webedit.git', :tag => 'v0.0.3'" >> Gemfile
bundle install
rails server

then goto 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.


I used the source code you provided and added a directory under controllers. Seems to work fine now. Since you have the controller inside a module, you need to create this directory structure:

app/controllers/webedit/public_files_controller.rb

Not exactly sure why it was loading every other time, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号