Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- map.resources :users
- #map.resources :companies, :has_many => :regions
- #map.resources :regions, :has_many => :locations
- map.resources :companies do |companies|
- companies.resources :regions do |regions|
- regions.resources :locations do |locations|
- locations.resources :sales
- end
- end
- end
- ## Regions controller
- def create
- @company = Company.find(params[:company_id])
- @region = @company.regions.build(params[:region])
- respond_to do |format|
- if @region.save
- flash[:notice] = 'Region was successfully created.'
- format.html { redirect_to company_region_url(@company, @region) }
- format.xml { render :xml => @region, :status => :created, :location => @region }
- else
- format.html { render :action => "new" }
- format.xml { render :xml => @region.errors, :status => :unprocessable_entity }
- end
- end
- end
Add Comment
Please, Sign In to add comment