Rails Engines problem: routing_error.erb within rescues/layout

I’m working through the Rails Engines tutorial at http://edgeguides.rubyonrails.org/engines.html. I’m using ruby 1.9.3 and rails 3.1.12 on Linux. I’m stuck on section 4.1. When I try to access localhost:3000/blog I get:

Started GET “/blog” for 127.0.0.1 at 2013-12-26 15:25:12 -0500

ActionController::RoutingError (No route matches [GET] “/blog”):

Rendered /home/XXX/.rvm/gems/ruby-1.9.3-p484/gems/actionpack-3.1.12/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (47.4ms)

But, It looks like that should be a valid route:

$ rake routes
blorgh /blog {:to=>Blorgh::Engine}

The engine is included in the bundle:

$ bundle show
Gems included by the bundle:

  • actionmailer (3.1.12)
  • actionpack (3.1.12)
  • activemodel (3.1.12)
  • activerecord (3.1.12)
  • activeresource (3.1.12)
  • activesupport (3.1.12)
  • ansi (1.4.3)
  • arel (2.2.3)
  • blorgh (0.0.1)
  • builder (3.0.4)
  • bundler (1.3.5)
  • coffee-rails (3.1.1)
  • coffee-script (2.2.0)
  • coffee-script-source (1.6.3)
  • erubis (2.7.0)
  • execjs (2.0.2)
  • hike (1.2.3)
  • i18n (0.6.9)
  • jquery-rails (3.0.4)
  • json (1.8.1)
  • libv8 (3.16.14.3)
  • mail (2.4.4)
  • mime-types (1.25.1)
  • multi_json (1.8.2)
  • polyglot (0.3.3)
  • rack (1.3.10)
  • rack-cache (1.2)
  • rack-mount (0.8.3)
  • rack-ssl (1.3.3)
  • rack-test (0.6.2)
  • rails (3.1.12)
  • railties (3.1.12)
  • rake (10.1.1)
  • rdoc (3.12.2)
  • ref (1.0.5)
  • sass (3.2.13)
  • sass-rails (3.1.7)
  • sprockets (2.0.4)
  • sqlite3 (1.3.8)
  • therubyracer (0.12.0)
  • thor (0.14.6)
  • tilt (1.3.7)
  • treetop (1.4.15)
  • turn (0.8.3)
  • tzinfo (0.3.38)
  • uglifier (2.4.0)

Where should I look for the error?

Thanks.

I forgot to add-

Google did not help me.

That guide is for the rails development branch (i.e currently it’s probably tracking rails 4.1), so it may differ significantly from rails 3.1.12. I don’t thing 3.1.x is maintained anymore, however the rails 3.2.x guides are at http://guides.rubyonrails.org/v3.2.14/engines.html and the rails 4.0.x guides are at http://guides.rubyonrails.org.

I would start by picking one of those versions and going along with the corresponding guide

Fred

I’m working through the Rails Engines tutorial at http://edgeguides.rubyonrails.org/engines.html. I’m using ruby 1.9.3 and rails 3.1.12 on Linux. I’m stuck on section 4.1. When I try to access localhost:3000/blog I get:

Started GET “/blog” for 127.0.0.1 at 2013-12-26 15:25:12 -0500

ActionController::RoutingError (No route matches [GET] “/blog”):

Rendered /home/XXX/.rvm/gems/ruby-1.9.3-p484/gems/actionpack-3.1.12/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (47.4ms)

But, It looks like that should be a valid route:

$ rake routes
blorgh /blog {:to=>Blorgh::Engine}

If you haven’t already, try restarting your local Rails application. I’ve lost track of what still doesn’t get reloaded automatically, but stoping the local app and restarting tends to cure quite a lot of these issues.

In particular, if you added the route after the application was started, there’s a good chance that the running application doesn’t actually know even though the rake routes command claims it exists (since it just freshly loaded everthing ;-).

-Rob

Thanks. Upgrading to rails 3.2.12 did the trick. My company is not ready for rails 4 yet.

Uh, and you realize that 3.2.13, 3.2.15, and 3.2.16 (latest 3.2.x) all
include critical security fixes, right? :slight_smile:

Thanks. I upgraded to 3.2.16. Actually, I am not very concerned about this because all my applications run on an intranet and are not accessible outside my company. The users here are not sophisticated enough to exploit any security holes in rails.

I am now going to merge several rails applications into a single one using engines so that they remain separated. Many of the models appear in multiple applications (now engines) and have some methods in common. I want to keep my code DRY. I did not see how to factor out the common methods while going through the tutorial. Some pointers would be appreciated.