Skip to content

Instantly share code, notes, and snippets.

@fujin
Created September 22, 2008 03:30
Show Gist options
  • Save fujin/11935 to your computer and use it in GitHub Desktop.
Save fujin/11935 to your computer and use it in GitHub Desktop.
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |r|
# This deferred route allows permalinks to be handled, without a separate rack handler
defer_to do |request, path_match|
unless (article = Article.find_by_permalink(request.uri.to_s.chomp("/"))).nil?
{:controller => "articles", :action => "show", :id => article.id}
end
end
# Admin namespace
namespace :admin do |admin|
admin.resource :configurations
admin.resources :dashboard
admin.resources :categories
admin.resources :plugins
admin.resources :articles
admin.match("").to(:controller => "dashboard", :action => "index")
end
# Mount merb-auth.
add_slice :MerbAuth, "admin"
# Year/month/day routes
match("/:year").to(:controller => "articles", :action => "index").name(:year)
match("/:year/:month").to(:controller => "articles", :action => "index").name(:month)
match("/:year/:month/:day").to(:controller => "articles", :action => "index").name(:day)
# Default routes, and index
default_routes
match('/').to(:controller => 'articles', :action =>'index')
end
aj@junglist (branch: pagination) ~/junglist$ merb
~ Loaded DEVELOPMENT Environment...
~ loading gem 'merb_datamapper' ...
~ loading gem 'dm-is-paginated' ...
~ loading gem 'merb-pagination' ...
~ loading gem 'merb_helpers' ...
~ loading gem 'merb-assets' ...
~ loading gem 'merb-cache' ...
~ loading gem 'merb-action-args' ...
~ loading gem 'merb_has_flash' ...
~ loading gem 'merb_helpers' ...
~ loading gem 'merb-mailer' ...
~ loading gem 'merb-slices' ...
~ Registered slice 'MerbAuth' located at /usr/lib/ruby/gems/1.8/gems/merb-auth-0.1.0
~ loading gem 'merb-auth' ...
~ loading gem 'dm-aggregates' ...
~ loading gem 'dm-validations' ...
~ loading gem 'dm-timestamps' ...
~ loading gem 'dm-core' ...
~ Connecting to database...
~ WARNING: Merb.orm_generator_scope is deprecated
~ Loaded slice 'MerbAuth' ...
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/router/behavior.rb:333:in `namespace': The route has already been committed. Further options cannot be specified (Merb::Router::Behavior::Error)
from (eval):3:in `namespace'
from /home/aj/www/junglist/config/router.rb:32
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/router/behavior.rb:507:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/router/behavior.rb:507:in `with_proxy'
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/router.rb:58:in `prepare'
from /home/aj/www/junglist/config/router.rb:23
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/bootloader.rb:380:in `load'
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/bootloader.rb:380:in `load_file'
... 11 levels...
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core.rb:108:in `start'
from /usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/bin/merb:11
from /usr/bin/merb:19:in `load'
from /usr/bin/merb:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment