3

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 gems, made cleanup.)

Many thanks, gezope

YogiZoli
  • 870
  • 1
  • 9
  • 17

2 Answers2

6

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.

Xylakant
  • 112
  • 3
  • First I tried your way, wrote this line to Gemfile, then run bundle install. Was updated succesfully. Then I run bundle exec padrino. After that nothing worked well, still wrote in console that I need Sinatra 1.1.0 since it's in my Gemfile, but I have Sinatra 1.1.2. Finally I deleted Sinatra 1.1.2, this helped. Seemed like bundle exec padrino was not working at all. – YogiZoli Dec 29 '10 at 02:19
  • After I deleted Sinatra 1.1.2 the original Padrino way wasn't work at all, it gave me this error message: BCrypt::Errors::InvalidHash at /admin/sessions/create . I checked and it's a DataMapper problem, still in their tracker, unsolved. So finally I restarted the whole app with ActiveRecord, now it works fine. – YogiZoli Dec 29 '10 at 02:21
  • I write here the way I did it, later it can help others: Step1. gem install sinatra -v=1.1.0 then Step2. gem delete sinatra -v=1.1.2 then Step3. padrino g project testapp -d activerecord (important: not datamapper) then Step4. cd testapp then Step5. padrino g admin then Step7. padrino rake ar:migrate seed finally Step8. padrino start – YogiZoli Dec 29 '10 at 02:25
  • @gezope: I meant you should use "bundle exec padrino " everywhere you'd normally use "padrino ". This should work without deinstalling sinatra 1.1.2. – Xylakant Jan 03 '11 at 22:23
1

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!

Greg Edwards
  • 598
  • 1
  • 5
  • 12
  • This hack works, so I'll leave it here, BUT it is better to pin the sinatra version that you're using to a version that's compatible with sinatra 0.9.19 (described on this page above). – Greg Edwards Dec 30 '10 at 16:28