Change URL of Active_Admin Resource | how to iverwrite AA routing? - ruby-on-rails

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.

Related

Generating Paths and URLs from Code in rails

If I put this in route.rb get '/products/:id', to: 'products#edit' edit action should be called when the url format is /patients/:id does this mean it will be redirected to edit page? I tried this and it is not redirecting.
This is my rake routes output
admin GET /admin(.:format) {:action=>"index", :controller=>"admin"}
GET /products/:id(.:format) {:controller=>"products", :action=>"edit"}
login GET /login(.:format) {:action=>"new", :controller=>"sessions"}
POST /login(.:format) {:action=>"create", :controller=>"sessions"}
logout DELETE /logout(.:format) {:action=>"destroy", :controller=>"sessions"}
users GET (/:locale)/users(.:format) {:action=>"index", :controller=>"users"}
POST (/:locale)/users(.:format) {:action=>"create", :controller=>"users"}
new_user GET (/:locale)/users/new(.:format) {:action=>"new", :controller=>"users"}
edit_user GET (/:locale)/users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
user GET (/:locale)/users/:id(.:format) {:action=>"show", :controller=>"users"}
PUT (/:locale)/users/:id(.:format) {:action=>"update", :controller=>"users"}
DELETE (/:locale)/users/:id(.:format) {:action=>"destroy", :controller=>"users"}
orders GET (/:locale)/orders(.:format) {:action=>"index", :controller=>"orders"}
POST (/:locale)/orders(.:format) {:action=>"create", :controller=>"orders"}
new_order GET (/:locale)/orders/new(.:format) {:action=>"new", :controller=>"orders"}
edit_order GET (/:locale)/orders/:id/edit(.:format) {:action=>"edit", :controller=>"orders"}
order GET (/:locale)/orders/:id(.:format) {:action=>"show", :controller=>"orders"}
PUT (/:locale)/orders/:id(.:format) {:action=>"update", :controller=>"orders"}
DELETE (/:locale)/orders/:id(.:format) {:action=>"destroy", :controller=>"orders"}
line_items GET (/:locale)/line_items(.:format) {:action=>"index", :controller=>"line_items"}
POST (/:locale)/line_items(.:format) {:action=>"create", :controller=>"line_items"}
new_line_item GET (/:locale)/line_items/new(.:format) {:action=>"new", :controller=>"line_items"}
edit_line_item GET (/:locale)/line_items/:id/edit(.:format) {:action=>"edit", :controller=>"line_items"}
line_item GET (/:locale)/line_items/:id(.:format) {:action=>"show", :controller=>"line_items"}
PUT (/:locale)/line_items/:id(.:format) {:action=>"update", :controller=>"line_items"}
DELETE (/:locale)/line_items/:id(.:format) {:action=>"destroy", :controller=>"line_items"}
carts GET (/:locale)/carts(.:format) {:action=>"index", :controller=>"carts"}
POST (/:locale)/carts(.:format) {:action=>"create", :controller=>"carts"}
new_cart GET (/:locale)/carts/new(.:format) {:action=>"new", :controller=>"carts"}
edit_cart GET (/:locale)/carts/:id/edit(.:format) {:action=>"edit", :controller=>"carts"}
cart GET (/:locale)/carts/:id(.:format) {:action=>"show", :controller=>"carts"}
PUT (/:locale)/carts/:id(.:format) {:action=>"update", :controller=>"carts"}
DELETE (/:locale)/carts/:id(.:format) {:action=>"destroy", :controller=>"carts"}
who_bought_product GET (/:locale)/products/:id/who_bought(.:format) {:action=>"who_bought", :controller=>"products"}
products GET (/:locale)/products(.:format) {:action=>"index", :controller=>"products"}
POST (/:locale)/products(.:format) {:action=>"create", :controller=>"products"}
new_product GET (/:locale)/products/new(.:format) {:action=>"new", :controller=>"products"}
edit_product GET (/:locale)/products/:id/edit(.:format) {:action=>"edit", :controller=>"products"}
product GET (/:locale)/products/:id(.:format) {:action=>"show", :controller=>"products"}
PUT (/:locale)/products/:id(.:format) {:action=>"update", :controller=>"products"}
DELETE (/:locale)/products/:id(.:format) {:action=>"destroy", :controller=>"products"}
store /(:locale)(.:format) {:controller=>"store", :action=>"index"}
The route you've got there doesn't do a redirect, it maps the url /patients/:id to the edit action of the PatientsController.
When a user hits the /patients/id url, the edit action will be invoked. By default this tries to render a view with the same name as the action.
If you want to render an edit page, create a view in the /app/views/patients folder called edit.html.erb.
(By the way, the GET /model/:id route is generally used for the show action.)

Routing issue with Rails 3

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!

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