开发者

Notmethod error when padrino start

unfortunately got lost in the begginning. Created first test_app using the official guide http://www.padrinorb.com/

When trying "padrino start" app starts, server is running well in console, but as soon as I try to see it in the borwser this error message occurs:

NoMethodError at /admin/ undefined method `matched?' for nil:NilClass file: routing.rb location: route line: 66

Also I can't see the favicon, and console says it could not find that.

(Tried with Thin and also with Webrick. I'm using Ubuntu with RVM Ruby1.9 Gem 1.3.7 Rails3. Updated Sinatra and Padrino gem开发者_如何转开发s, made cleanup.)

Many thanks, gezope


A better solution is probably to pin the sinatra version that you're using to a version that's compatible with sinatra 0.9.19. Sinatra 1.1.0 works fine for me. To do that, add this line to your Gemfile:

gem 'sinatra', '1.1.0'

and call

bundle update

You'll have use bundle exec padrino from there on though.


This is a quick hack that can solve it. It should probably be solved in the framework, but at least you can solve it right now so that you can keep working:

On my system, I modified the following file (assuming your are using bundler) (note: the full path to the file was listed when you clicked on "expand" at the top of the error page that Padrino produces): file: .bundle/ruby/1.8/gems/padrino-core-0.9.19/lib/padrino-core/application/routing.rb

Original (this will fail) code:

   def route
      match.matched? ? match.path.route : nil  # NOTE: this is line 66 in routing.rb
    end

New code (hacky, but it works and will take you about one minute)

   def route
      (!match.nil? && match.matched?) ? match.path.route : nil
    end

Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜