Routing issue with Rails 3 - ruby-on-rails

Rails newbie question that I can't seem to figure out. At some point I managed to break routing from one of my resources in my application sitewide. I'm getting the following for every page on my site:
Routing Error
No route matches {:action=>"show", :controller=>"assets", :ext=>"css", :body=>true, :digest=>false, :id=>#}
If I remove the <%= stylesheet_link_tag "application" %> and <%= javascript_include_tag "application" %> everything works correctly.
I have the following in my route.rb file:
resources :security_prices
resources :securities
resources :assets
resources :portfolios do
resources :accounts
end
but when I do a rake routes
I get:
security_prices GET /security_prices(.:format) {:action=>"index", :controller=>"security_prices"}
POST /security_prices(.:format) {:action=>"create", :controller=>"security_prices"}
new_security_price GET /security_prices/new(.:format) {:action=>"new", :controller=>"security_prices"}
edit_security_price GET /security_prices/:id/edit(.:format) {:action=>"edit", :controller=>"security_prices"}
security_price GET /security_prices/:id(.:format) {:action=>"show", :controller=>"security_prices"}
PUT /security_prices/:id(.:format) {:action=>"update", :controller=>"security_prices"}
DELETE /security_prices/:id(.:format) {:action=>"destroy", :controller=>"security_prices"}
securities GET /securities(.:format) {:action=>"index", :controller=>"securities"}
POST /securities(.:format) {:action=>"create", :controller=>"securities"}
new_security GET /securities/new(.:format) {:action=>"new", :controller=>"securities"}
edit_security GET /securities/:id/edit(.:format) {:action=>"edit", :controller=>"securities"}
security GET /securities/:id(.:format) {:action=>"show", :controller=>"securities"}
PUT /securities/:id(.:format) {:action=>"update", :controller=>"securities"}
DELETE /securities/:id(.:format) {:action=>"destroy", :controller=>"securities"}
portfolio_accounts GET /portfolios/:portfolio_id/accounts(.:format) {:action=>"index", :controller=>"accounts"}
POST /portfolios/:portfolio_id/accounts(.:format) {:action=>"create", :controller=>"accounts"}
new_portfolio_account GET /portfolios/:portfolio_id/accounts/new(.:format) {:action=>"new", :controller=>"accounts"}
edit_portfolio_account GET /portfolios/:portfolio_id/accounts/:id/edit(.:format) {:action=>"edit", :controller=>"accounts"}
portfolio_account GET /portfolios/:portfolio_id/accounts/:id(.:format) {:action=>"show", :controller=>"accounts"}
PUT /portfolios/:portfolio_id/accounts/:id(.:format) {:action=>"update", :controller=>"accounts"}
DELETE /portfolios/:portfolio_id/accounts/:id(.:format) {:action=>"destroy", :controller=>"accounts"}
portfolios GET /portfolios(.:format) {:action=>"index", :controller=>"portfolios"}
POST /portfolios(.:format) {:action=>"create", :controller=>"portfolios"}
new_portfolio GET /portfolios/new(.:format) {:action=>"new", :controller=>"portfolios"}
edit_portfolio GET /portfolios/:id/edit(.:format) {:action=>"edit", :controller=>"portfolios"}
portfolio GET /portfolios/:id(.:format) {:action=>"show", :controller=>"portfolios"}
PUT /portfolios/:id(.:format) {:action=>"update", :controller=>"portfolios"}
DELETE /portfolios/:id(.:format) {:action=>"destroy", :controller=>"portfolios"}
home_index GET /home/index(.:format) {:controller=>"home", :action=>"index"}
root / {:controller=>"home", :action=>"index"}
which obviously doesn't have assets so I suspect I'm flubbing something. How do I go about debugging this?

remove the resources :assets from the routes.rb rails is doing this on its own you dont need ressources for that!

Related

Rails: How to make a custom route from resource

I have an Enki blog set up and the sign in's at www.localhost:3000/admin.`
I'm guessing that this admin url is determined by this code from routes, but, for extra security reasons, I'd like to make the login, for example,
www.localhost:3000/ilovejesus
Enki::Application.routes.draw do
namespace 'admin' do
resource :session
Based on what rake routes is telling me, I'm guessing it's the admin_root that goes to :controller => Admin/Dashboard, :action => 'show' that needs to get changed.
So can anyone tell me how I might change this too, for example, localhost:3000/iloveronpaul
Rake Routes:
admin_session POST /admin/session(.:format) {:action=>"create", :controller=>"admin/sessions"}
new_admin_session GET /admin/session/new(.:format) {:action=>"new", :controller=>"admin/sessions"}
edit_admin_session GET /admin/session/edit(.:format) {:action=>"edit", :controller=>"admin/sessions"}
GET /admin/session(.:format) {:action=>"show", :controller=>"admin/sessions"}
PUT /admin/session(.:format) {:action=>"update", :controller=>"admin/sessions"}
DELETE /admin/session(.:format) {:action=>"destroy", :controller=>"admin/sessions"}
preview_admin_posts POST /admin/posts/preview(.:format) {:action=>"preview", :controller=>"admin/posts"}
admin_posts GET /admin/posts(.:format) {:action=>"index", :controller=>"admin/posts"}
POST /admin/posts(.:format) {:action=>"create", :controller=>"admin/posts"}
new_admin_post GET /admin/posts/new(.:format) {:action=>"new", :controller=>"admin/posts"}
edit_admin_post GET /admin/posts/:id/edit(.:format) {:action=>"edit", :controller=>"admin/posts"}
admin_post GET /admin/posts/:id(.:format) {:action=>"show", :controller=>"admin/posts"}
PUT /admin/posts/:id(.:format) {:action=>"update", :controller=>"admin/posts"}
DELETE /admin/posts/:id(.:format) {:action=>"destroy", :controller=>"admin/posts"}
preview_admin_pages POST /admin/pages/preview(.:format) {:action=>"preview", :controller=>"admin/pages"}
admin_pages GET /admin/pages(.:format) {:action=>"index", :controller=>"admin/pages"}
POST /admin/pages(.:format) {:action=>"create", :controller=>"admin/pages"}
new_admin_page GET /admin/pages/new(.:format) {:action=>"new", :controller=>"admin/pages"}
edit_admin_page GET /admin/pages/:id/edit(.:format) {:action=>"edit", :controller=>"admin/pages"}
admin_page GET /admin/pages/:id(.:format) {:action=>"show", :controller=>"admin/pages"}
PUT /admin/pages/:id(.:format) {:action=>"update", :controller=>"admin/pages"}
DELETE /admin/pages/:id(.:format) {:action=>"destroy", :controller=>"admin/pages"}
admin_comments GET /admin/comments(.:format) {:action=>"index", :controller=>"admin/comments"}
POST /admin/comments(.:format) {:action=>"create", :controller=>"admin/comments"}
new_admin_comment GET /admin/comments/new(.:format) {:action=>"new", :controller=>"admin/comments"}
edit_admin_comment GET /admin/comments/:id/edit(.:format) {:action=>"edit", :controller=>"admin/comments"}
admin_comment GET /admin/comments/:id(.:format) {:action=>"show", :controller=>"admin/comments"}
PUT /admin/comments/:id(.:format) {:action=>"update", :controller=>"admin/comments"}
DELETE /admin/comments/:id(.:format) {:action=>"destroy", :controller=>"admin/comments"}
undo_admin_undo_item POST /admin/undo_items/:id/undo(.:format) {:action=>"undo", :controller=>"admin/undo_items"}
admin_undo_items GET /admin/undo_items(.:format) {:action=>"index", :controller=>"admin/undo_items"}
POST /admin/undo_items(.:format) {:action=>"create", :controller=>"admin/undo_items"}
new_admin_undo_item GET /admin/undo_items/new(.:format) {:action=>"new", :controller=>"admin/undo_items"}
edit_admin_undo_item GET /admin/undo_items/:id/edit(.:format) {:action=>"edit", :controller=>"admin/undo_items"}
admin_undo_item GET /admin/undo_items/:id(.:format) {:action=>"show", :controller=>"admin/undo_items"}
PUT /admin/undo_items/:id(.:format) {:action=>"update", :controller=>"admin/undo_items"}
DELETE /admin/undo_items/:id(.:format) {:action=>"destroy", :controller=>"admin/undo_items"}
admin_health /admin/health(/:action)(.:format) {:action=>"index", :controller=>"admin/health"}
admin_root /admin(.:format) {:controller=>"admin/dashboard", :action=>"show"}
archives GET /archives(.:format) {:action=>"index", :controller=>"archives"}
page GET /pages/:id(.:format) {:action=>"show", :controller=>"pages"}
GET /:year/:month/:day/:slug/comments(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"comments", :action=>"index"}
POST /:year/:month/:day/:slug/comments(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"comments", :action=>"create"}
GET /:year/:month/:day/:slug/comments/new(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"comments", :action=>"new"}
GET /:year/:month/:day/:slug(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"posts", :action=>"show"}
formatted_posts GET /posts.:format {:controller=>"posts", :action=>"index"}
posts GET /(:tag)(.:format) {:controller=>"posts", :action=>"index"}
root /(.:format) {:controller=>"posts", :action=>"index"}
Add a :path option to your namespace
Enki::Application.routes.draw do
scope :module => 'admin' do
resource :session, :path_names => { :new => "liverandonions",
:show => "ilovejesus,
:edit => "iloveronpaul" }
I'm not sure but the path_names options might have to be wrapped in array.
ie.
resource :session, :path_names => { [:new => "liverandonions",
:show => "ilovejesus,
:edit => "iloveronpaul"] }
let me know which one works.

Change URL of Active_Admin Resource | how to iverwrite AA routing?

I want to change the route of a resource from "/partner_programms" to "/programmangebot".
is there a way to do it with active_admin without put in my own route to routes.rb?
ActiveAdmin do:
admin_categories GET /admin/categories(.:format) {:action=>"index", :controller=>"admin/categories"}
POST /admin/categories(.:format) {:action=>"create", :controller=>"admin/categories"}
new_admin_category GET /admin/categories/new(.:format) {:action=>"new", :controller=>"admin/categories"}
edit_admin_category GET /admin/categories/:id/edit(.:format) {:action=>"edit", :controller=>"admin/categories"}
admin_category GET /admin/categories/:id(.:format) {:action=>"show", :controller=>"admin/categories"}
PUT /admin/categories/:id(.:format) {:action=>"update", :controller=>"admin/categories"}
DELETE /admin/categories/:id(.:format) {:action=>"destroy", :controller=>"admin/categories"}
when i do
#routes.rb
namespace :admin do
resources :categories, :path=>"Kategorien"
end
i get unnamed routes
admin_categories GET /admin/categories(.:format) {:action=>"index", :controller=>"admin/categories"}
POST /admin/categories(.:format) {:action=>"create", :controller=>"admin/categories"}
new_admin_category GET /admin/categories/new(.:format) {:action=>"new", :controller=>"admin/categories"}
edit_admin_category GET /admin/categories/:id/edit(.:format) {:action=>"edit", :controller=>"admin/categories"}
admin_category GET /admin/categories/:id(.:format) {:action=>"show", :controller=>"admin/categories"}
PUT /admin/categories/:id(.:format) {:action=>"update", :controller=>"admin/categories"}
DELETE /admin/categories/:id(.:format) {:action=>"destroy", :controller=>"admin/categories"}
GET /admin/Kategorien(.:format) {:action=>"index", :controller=>"admin/categories"}
POST /admin/Kategorien(.:format) {:action=>"create", :controller=>"admin/categories"}
GET /admin/Kategorien/new(.:format) {:action=>"new", :controller=>"admin/categories"}
GET /admin/Kategorien/:id/edit(.:format) {:action=>"edit", :controller=>"admin/categories"}
GET /admin/Kategorien/:id(.:format) {:action=>"show", :controller=>"admin/categories"}
PUT /admin/Kategorien/:id(.:format) {:action=>"update", :controller=>"admin/categories"}
DELETE /admin/Kategorien/:id(.:format) {:action=>"destroy", :controller=>"admin/categories"}
Another way would be to rename the resource:
ActiveAdmin.register Partner::Programms, as: 'Programmangebot' do
This changes all references to the resource.
You could add routes via another file as described at Rails Best Practices – split route namespaces into different files. I don't know how you'd remove the existing route.
correct answer of comment:
tried adding admin/Kategorien after ActiveAdmin.routes(self) and got the same result as you, the new routes were unnamed. If I put the admin/Kategorien route above ActiveAdmin.routes(self), then the my Kategorien routes were named, and the ActiveAdmin ones were unnamed.

Weird Routing Issue - No Method Error

I'm getting a no method error when loading form for a nested resource. I have a fix for it but it's not right I'm sure.
My routes.rb contains:
resources :orders do
resources :comments, :technicals, :milestones
end
At the top of my techncials.html.erb form I have this:
<%= semantic_form_for([#order, #technical]) do |f| %>
When loading the form, I get an error:
> NoMethodError in Technicals#new
>
> undefined method `technicals_path' for
> #<#<Class:0x00000102118318>:0x000001020ec470>
If I then put this in my routes, it all works just fine:
resources :technicals, :only => [ :create ]
What on earth am I doing wrong, if anything??!
Edit: I think My models etc. are all set up correctly:
class Technical < ActiveRecord::Base
belongs_to :order
end
-- edit --
company_order_comments GET /companies/:company_id/orders/:order_id/comments(.:format) {:action=>"index", :controller=>"comments"}
POST /companies/:company_id/orders/:order_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_company_order_comment GET /companies/:company_id/orders/:order_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
edit_company_order_comment GET /companies/:company_id/orders/:order_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
company_order_comment GET /companies/:company_id/orders/:order_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /companies/:company_id/orders/:order_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
DELETE /companies/:company_id/orders/:order_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
company_orders GET /companies/:company_id/orders(.:format) {:action=>"index", :controller=>"orders"}
POST /companies/:company_id/orders(.:format) {:action=>"create", :controller=>"orders"}
new_company_order GET /companies/:company_id/orders/new(.:format) {:action=>"new", :controller=>"orders"}
edit_company_order GET /companies/:company_id/orders/:id/edit(.:format) {:action=>"edit", :controller=>"orders"}
company_order GET /companies/:company_id/orders/:id(.:format) {:action=>"show", :controller=>"orders"}
PUT /companies/:company_id/orders/:id(.:format) {:action=>"update", :controller=>"orders"}
DELETE /companies/:company_id/orders/:id(.:format) {:action=>"destroy", :controller=>"orders"}
companies GET /companies(.:format) {:action=>"index", :controller=>"companies"}
POST /companies(.:format) {:action=>"create", :controller=>"companies"}
new_company GET /companies/new(.:format) {:action=>"new", :controller=>"companies"}
edit_company GET /companies/:id/edit(.:format) {:action=>"edit", :controller=>"companies"}
company GET /companies/:id(.:format) {:action=>"show", :controller=>"companies"}
PUT /companies/:id(.:format) {:action=>"update", :controller=>"companies"}
DELETE /companies/:id(.:format) {:action=>"destroy", :controller=>"companies"}
order_comments GET /orders/:order_id/comments(.:format) {:action=>"index", :controller=>"comments"}
POST /orders/:order_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_order_comment GET /orders/:order_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
edit_order_comment GET /orders/:order_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
order_comment GET /orders/:order_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /orders/:order_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
DELETE /orders/:order_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
order_technicals GET /orders/:order_id/technicals(.:format) {:action=>"index", :controller=>"technicals"}
POST /orders/:order_id/technicals(.:format) {:action=>"create", :controller=>"technicals"}
new_order_technical GET /orders/:order_id/technicals/new(.:format) {:action=>"new", :controller=>"technicals"}
edit_order_technical GET /orders/:order_id/technicals/:id/edit(.:format) {:action=>"edit", :controller=>"technicals"}
order_technical GET /orders/:order_id/technicals/:id(.:format) {:action=>"show", :controller=>"technicals"}
PUT /orders/:order_id/technicals/:id(.:format) {:action=>"update", :controller=>"technicals"}
DELETE /orders/:order_id/technicals/:id(.:format) {:action=>"destroy", :controller=>"technicals"}
order_milestones GET /orders/:order_id/milestones(.:format) {:action=>"index", :controller=>"milestones"}
POST /orders/:order_id/milestones(.:format) {:action=>"create", :controller=>"milestones"}
new_order_milestone GET /orders/:order_id/milestones/new(.:format) {:action=>"new", :controller=>"milestones"}
edit_order_milestone GET /orders/:order_id/milestones/:id/edit(.:format) {:action=>"edit", :controller=>"milestones"}
order_milestone GET /orders/:order_id/milestones/:id(.:format) {:action=>"show", :controller=>"milestones"}
PUT /orders/:order_id/milestones/:id(.:format) {:action=>"update", :controller=>"milestones"}
DELETE /orders/:order_id/milestones/:id(.:format) {:action=>"destroy", :controller=>"milestones"}
orders GET /orders(.:format) {:action=>"index", :controller=>"orders"}
POST /orders(.:format) {:action=>"create", :controller=>"orders"}
new_order GET /orders/new(.:format) {:action=>"new", :controller=>"orders"}
edit_order GET /orders/:id/edit(.:format) {:action=>"edit", :controller=>"orders"}
order GET /orders/:id(.:format) {:action=>"show", :controller=>"orders"}
PUT /orders/:id(.:format) {:action=>"update", :controller=>"orders"}
DELETE /orders/:id(.:format) {:action=>"destroy", :controller=>"orders"}
/orders(.:format) {:controller=>"orders", :action=>"index"}
root /(.:format) {:controller=>"home", :action=>"index"}
NoMethodError in Technicals#new
Does controllers/technicals_controller.rb have a "def new"?
If not, try adding one:
def new
#technical = Technical.new
end

Singular resources namespaced by its slug (Routing)

I have the followed Rails 3 routes:
Hello::Application.routes.draw do
resources :blogs do
resources :articles do
resources :comments
end
end
end
By raking them, we can find:
GET /blogs/:blog_id/articles/:article_id/comments(.:format) {:action=>"index", :controller=>"comments"}
blog_article_comments POST /blogs/:blog_id/articles/:article_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_blog_article_comment GET /blogs/:blog_id/articles/:article_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
GET /blogs/:blog_id/articles/:article_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /blogs/:blog_id/articles/:article_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
blog_article_comment DELETE /blogs/:blog_id/articles/:article_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
edit_blog_article_comment GET /blogs/:blog_id/articles/:article_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
GET /blogs/:blog_id/articles(.:format) {:action=>"index", :controller=>"articles"}
blog_articles POST /blogs/:blog_id/articles(.:format) {:action=>"create", :controller=>"articles"}
new_blog_article GET /blogs/:blog_id/articles/new(.:format) {:action=>"new", :controller=>"articles"}
GET /blogs/:blog_id/articles/:id(.:format) {:action=>"show", :controller=>"articles"}
PUT /blogs/:blog_id/articles/:id(.:format) {:action=>"update", :controller=>"articles"}
blog_article DELETE /blogs/:blog_id/articles/:id(.:format) {:action=>"destroy", :controller=>"articles"}
edit_blog_article GET /blogs/:blog_id/articles/:id/edit(.:format) {:action=>"edit", :controller=>"articles"}
GET /blogs(.:format) {:action=>"index", :controller=>"blogs"}
blogs POST /blogs(.:format) {:action=>"create", :controller=>"blogs"}
new_blog GET /blogs/new(.:format) {:action=>"new", :controller=>"blogs"}
GET /blogs/:id(.:format) {:action=>"show", :controller=>"blogs"}
PUT /blogs/:id(.:format) {:action=>"update", :controller=>"blogs"}
blog DELETE /blogs/:id(.:format) {:action=>"destroy", :controller=>"blogs"}
edit_blog GET /blogs/:id/edit(.:format) {:action=>"edit", :controller=>"blogs"}
Because every routes begin with the same root path (/blogs), I would like to shorten addresses by removing it (when :blog_id is given).
In this why, I could have thoses routes (I think it's more DRY):
GET /:blog_id/articles/:article_id/comments(.:format) {:action=>"index", :controller=>"comments"}
blog_article_comments POST /:blog_id/articles/:article_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_blog_article_comment GET /:blog_id/articles/:article_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
GET /:blog_id/articles/:article_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /:blog_id/articles/:article_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
blog_article_comment DELETE /:blog_id/articles/:article_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
edit_blog_article_comment GET /:blog_id/articles/:article_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
GET /:blog_id/articles(.:format) {:action=>"index", :controller=>"articles"}
blog_articles POST /:blog_id/articles(.:format) {:action=>"create", :controller=>"articles"}
new_blog_article GET /:blog_id/articles/new(.:format) {:action=>"new", :controller=>"articles"}
GET /:blog_id/articles/:id(.:format) {:action=>"show", :controller=>"articles"}
PUT /:blog_id/articles/:id(.:format) {:action=>"update", :controller=>"articles"}
blog_article DELETE /:blog_id/articles/:id(.:format) {:action=>"destroy", :controller=>"articles"}
edit_blog_article GET /:blog_id/articles/:id/edit(.:format) {:action=>"edit", :controller=>"articles"}
GET /blogs(.:format) {:action=>"index", :controller=>"blogs"}
blogs POST /blogs(.:format) {:action=>"create", :controller=>"blogs"}
new_blog GET /blogs/new(.:format) {:action=>"new", :controller=>"blogs"}
GET /blogs/:id(.:format) {:action=>"show", :controller=>"blogs"}
PUT /blogs/:id(.:format) {:action=>"update", :controller=>"blogs"}
blog DELETE /blogs/:id(.:format) {:action=>"destroy", :controller=>"blogs"}
edit_blog GET /blogs/:id/edit(.:format) {:action=>"edit", :controller=>"blogs"}
According to you, what kind of change I should make over my current routes configuration?
Thanks.
My opinion is that you need to look at shallow routes. To my knowledge the customisation you are asking is not achievable using route resources and I don't think it's desirable.
Where you have defined one to many relationships you do not need to pass the identifier for each of the nested resources. This is considered bad practice (by some, though not others). For example, instead of this long url:
/blog/:blog_id/articles/:article_id/comments/:id
#controller
#blog = Blog.find params[:blog_id]
#article = Blog.find params[:article_id]
#comment = Comment.find params[:id]
you actually need only:
/comments/:id
#controller
#comment = Comment.find params[:id]
#article = #comment.article
#blog = #article.blog
More info:
http://railscasts.com/episodes/139-nested-resources
"Resources should never be nested more than 1 level deep." (http://guides.rubyonrails.org/routing.html)
If the Rails documentation is making this strong of a recommendation I have no idea why it is allowed still.

Uninitialized constant problem for Rails routes

Here's my route configuration:
map.resources :services do |services|
services.resources :capabilities do |capabilities|
capabilities.resources :http_headers
end
end
Here's my "rake routes" output:
laran:trunk laran$ rake routes
(in /Users/laran/workspace/kibo/mega/server/trunk)
accounts GET /accounts(.:format) {:action=>"index", :controller=>"accounts"}
POST /accounts(.:format) {:action=>"create", :controller=>"accounts"}
new_account GET /accounts/new(.:format) {:action=>"new", :controller=>"accounts"}
edit_account GET /accounts/:id/edit(.:format) {:action=>"edit", :controller=>"accounts"}
account GET /accounts/:id(.:format) {:action=>"show", :controller=>"accounts"}
PUT /accounts/:id(.:format) {:action=>"update", :controller=>"accounts"}
DELETE /accounts/:id(.:format) {:action=>"destroy", :controller=>"accounts"}
services GET /services(.:format) {:action=>"index", :controller=>"services"}
POST /services(.:format) {:action=>"create", :controller=>"services"}
new_service GET /services/new(.:format) {:action=>"new", :controller=>"services"}
edit_service GET /services/:id/edit(.:format) {:action=>"edit", :controller=>"services"}
service GET /services/:id(.:format) {:action=>"show", :controller=>"services"}
PUT /services/:id(.:format) {:action=>"update", :controller=>"services"}
DELETE /services/:id(.:format) {:action=>"destroy", :controller=>"services"}
service_capabilities GET /services/:service_id/capabilities(.:format) {:action=>"index", :controller=>"capabilities"}
POST /services/:service_id/capabilities(.:format) {:action=>"create", :controller=>"capabilities"}
new_service_capability GET /services/:service_id/capabilities/new(.:format) {:action=>"new", :controller=>"capabilities"}
edit_service_capability GET /services/:service_id/capabilities/:id/edit(.:format) {:action=>"edit", :controller=>"capabilities"}
service_capability GET /services/:service_id/capabilities/:id(.:format) {:action=>"show", :controller=>"capabilities"}
PUT /services/:service_id/capabilities/:id(.:format) {:action=>"update", :controller=>"capabilities"}
DELETE /services/:service_id/capabilities/:id(.:format) {:action=>"destroy", :controller=>"capabilities"}
service_capability_http_headers GET /services/:service_id/capabilities/:capability_id/http_headers(.:format) {:action=>"index", :controller=>"http_headers"}
POST /services/:service_id/capabilities/:capability_id/http_headers(.:format) {:action=>"create", :controller=>"http_headers"}
new_service_capability_http_header GET /services/:service_id/capabilities/:capability_id/http_headers/new(.:format) {:action=>"new", :controller=>"http_headers"}
edit_service_capability_http_header GET /services/:service_id/capabilities/:capability_id/http_headers/:id/edit(.:format) {:action=>"edit", :controller=>"http_headers"}
service_capability_http_header GET /services/:service_id/capabilities/:capability_id/http_headers/:id(.:format) {:action=>"show", :controller=>"http_headers"}
PUT /services/:service_id/capabilities/:capability_id/http_headers/:id(.:format) {:action=>"update", :controller=>"http_headers"}
DELETE /services/:service_id/capabilities/:capability_id/http_headers/:id(.:format) {:action=>"destroy", :controller=>"http_headers"}
/login {:action=>"login", :controller=>"accounts"}
/logout {:action=>"logout", :controller=>"accounts"}
root / {:action=>"index", :controller=>"default"}
laran:trunk laran$
When I go to /services/new though, I get this error:
NameError in ServicesController#new
uninitialized constant ServicesController::Services
What gives? How can I get things working and routed correctly? Thanks.
Is ServicesController backed up by a model Service? Did you accidentally reference it as Services in your controller?
This probably doesn't have anything to do with your routes; your new method in ServicesController is trying to use a (class? constant? object?) named Services that doesn't exist.

Resources