Skip to content

Instantly share code, notes, and snippets.

@lscott3
Created December 29, 2011 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lscott3/1531341 to your computer and use it in GitHub Desktop.
Save lscott3/1531341 to your computer and use it in GitHub Desktop.
Nested Resource Problem
<div id='new-category'>
<h4>Add a new category</h4>
<div id="error-space"></div>
<%= form_for([@account.vanity_url, @new_category]) do |cat| %>
<%= cat.text_field :name %>
<%= cat.submit %>
<% end -%>
<%= link_to "Close", "#", :id => "close" %>
</div>
Consultant::Application.routes.draw do
resources :packages
match "/:package/signup/" => "accounts#new", :as => :signup
resource :people
resource :fields
resource :user_session
resource :users
resources :accounts, :only => [:create]
match ':controller/page/:page' => ':controller#index'
match ':controller/:id/page/:page' => ':controller#show'
#Nested Resource for Companies/Items
scope "/:vanity_url", :as => :workspace do
#AJAX Routes
match '/category/:category_name' => 'categories#item_list_index', :as => :list_items_by_category, :via => [:get]
match '/category_check' => 'categories#category_check'
match '/load_attribute' => 'items#load_attribute'
match '/add_new_item' => 'companies#add_new_item'
match '/item_select' => 'service_records#item_select', :as => :item_select, :via => [:get]
#match "/" => "dashboard#index", :as => :root
match "/login" => "user_sessions#new", :as => :login
match "/logout" => "user_sessions#destroy", :as => :logout
match "/" => "dashboard#index", :as => :dashboard
resources :accounts, :only => [:show, :edit, :destroy]
resources :companies, :path => '/clients' do
resources :items
resources :notes
resources :service_records
resources :people
end
resources :service_records, :categories
resources :items do
resources :notes
end
resources :people do
resources :notes
end
resource :items, :only => [:index]
resources :password_resets
resources :users
#Other Routes
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment