svenfuchs / routing-filter

routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.
http://www.artweb-design.de
MIT License
464 stars 84 forks source link

something wrong with filter route #5

Closed edelmasure closed 14 years ago

edelmasure commented 14 years ago

Hi, as a fresh newbie with RoR, I guess I'm missing some trivial step. Anyway, I'm using jRuby 1.4 on Rails 2.3.4, and after installing routing-filter gem that is well sitting in the built-in jRuby directory, I got that error message while launching my app: => Booting WEBrick => Rails 2.3.4 application starting on http://0.0.0.0:3000 JRuby limited openssl loaded. gem install jruby-openssl for full support. http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/builder.rb:175:in build': Illegal route: the :controller must be specified! (ArgumentError) from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:309:inadd_route' from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:317:in add_named_route' from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:57:inmethod_missing' from /home/edel/Development/NetBeansProjects/biowizard/config/routes.rb:2 from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:226:in draw' from /home/edel/Development/NetBeansProjects/biowizard/config/routes.rb:1 from /home/edel/Development/NetBeansProjects/biowizard/config/routes.rb:145:inload' from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:in load_with_new_constant_marking' ... 16 levels... from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/server.rb:31:inrequire' from /home/edel/.netbeans/6.8/jruby-1.4.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from script/server:3

My route.rb:

ActionController::Routing::Routes.draw do |map| map.filter "locale" map.connect "", :controller => "homepage", :action => "show" ...

Any idea about what I'm missing ?

Best regards,

Ed.

jcf commented 14 years ago

Looks like you're trying to define a root route.

map.filter 'locale'
map.root :controller => :homepage, :action => :show

Try that instead and see if your error goes away.

edelmasure commented 14 years ago

Yups, I realize there has been a truncation while copy / pasting my route.rb head of code. Here is the real one, having the same effect, and the error message well targets the line number 2. Sounds like filter route is interpreted as a named route, and expected to have a :controller association ?! Could I miss some configuration that affects the regognition of the routing-filter library ? I just installed the gem, and wrote the map.filter directive in route.rb, as explained by the authors... (I'm working with NetBeans 6.8).

Regards,

Ed. ActionController::Routing::Routes.draw do |map| map.filter "locale"

map.connect "", :controller => "homepage", :action => "show"

map.root :controller => "homepage", :action => "show", :path_prefix => "/:locale"

edelmasure commented 14 years ago

Arf', be sure there are new lines between each route definition :-), I can't make that #$@! copy-paste keep my code format...

edelmasure commented 14 years ago

...and removing map.filter produces no error... but I can't benefit the path prefix managing convenience.

jcf commented 14 years ago

You need to require the gem as well as install it in your Gemfile if you're using Bundler or config/environment.rb if not.

jcf commented 14 years ago

If you don't know how to add a gem dependency to your Rails app there are instructions on http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies.

jcf commented 14 years ago

And if you want to insert a code block use four spaces before a line like this…

Ruby.is_much_better_than?(Java)
DHH.translate(MIT_LICENSE)
edelmasure commented 14 years ago

Thank you ;-) I was quite convinced I should declare something somewhere... but coming from J2EE RoR seams so magically human-friendly... I still have difficulst to discern dreams and reality ! Anyway, thank you for helping me in my first steps in RoR world ,-) !

Best Regards,

Ed.

edelmasure commented 14 years ago

just 'forgot to close...