Rails Engines problem: routing_error.erb within rescues/layout

370 views
Skip to first unread message

jsnark

unread,
Dec 26, 2013, 3:41:21 PM12/26/13
to rubyonra...@googlegroups.com
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.

jsnark

unread,
Dec 26, 2013, 3:51:29 PM12/26/13
to rubyonra...@googlegroups.com
I forgot to add-

Google did not help me.

Frederick Cheung

unread,
Dec 26, 2013, 5:24:43 PM12/26/13
to rubyonra...@googlegroups.com


On Thursday, December 26, 2013 8:41:21 PM UTC, jsnark wrote:
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:

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

 

Rob Biedenharn

unread,
Dec 26, 2013, 5:55:19 PM12/26/13
to rubyonra...@googlegroups.com
On 2013-Dec-26, at 15:41 , jsnark <s...@monmouth.com> wrote:

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/931bc974-e185-4a7f-96fe-b2c5a93d8db2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

jsnark

unread,
Dec 27, 2013, 10:41:54 AM12/27/13
to rubyonra...@googlegroups.com
Thanks.  Upgrading to rails 3.2.12 did the trick.  My company is not ready for rails 4 yet.

Hassan Schroeder

unread,
Dec 27, 2013, 11:13:03 AM12/27/13
to rubyonrails-talk
On Fri, Dec 27, 2013 at 7:41 AM, jsnark <s...@monmouth.com> wrote:

> Thanks. Upgrading to rails 3.2.12 did the trick.

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? :-)

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

jsnark

unread,
Dec 27, 2013, 12:18:07 PM12/27/13
to rubyonra...@googlegroups.com
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.
Reply all
Reply to author
Forward
0 new messages