开发者

Help migrating routes to rails 3 format

开发者 https://www.devze.com 2023-01-23 03:49 出处:网络
I am trying to figure out changing this routes.rb to the new rails 3 syntax but it\'s proving to be quite difficult... I know most of the sutff is simply removing the map.

I am trying to figure out changing this routes.rb to the new rails 3 syntax but it's proving to be quite difficult... I know most of the sutff is simply removing the map. but some of these routes I cant figure out what they were suppos开发者_运维百科ed to do in rails 2 to begin with... so if someone could help me get this to work without deprecation warnings I'd appreciate it'. Please Help.

MyProject::Application.routes.draw do |map|

      map.resources :grading_levels
       map.resources :class_timings
       map.resources :subjects
       map.resources :attendances
       map.resources :employee_attendances
       map.resources :attendance_reports

       map.feed 'courses/manage_course', :controller => 'courses' ,:action=>'manage_course'
       map.feed 'courses/manage_batches', :controller => 'courses' ,:action=>'manage_batches'
       map.resources :courses, :has_many => :batches

       map.resources :batches do |batch|
         batch.resources :exam_groups
         batch.resources :additional_exam_groups
         batch.resources :elective_groups, :as => :electives
       end

       map.resources :exam_groups do |exam_group|
         exam_group.resources :exams, :member => { :save_scores => :post }
       end

      map.resources :additional_exam_groups do |additional_exam_group|
         additional_exam_group.resources :additional_exams , :member => { :save_additional_scores => :post }
       end

       map.root :controller => 'users', :action => 'login'

       map.connect ':controller/:action/:id'
       map.connect ':controller/:action/:id/:id2'
       map.connect ':controller/:action/:id.:format'

    end


  resources :grading_levels
  resources :class_timings
  resources :subjects
  resources :attendances
  resources :employee_attendances
  resources :attendance_reports
  match 'courses/manage_course' => 'courses#manage_course', :as => :feed
  match 'courses/manage_batches' => 'courses#manage_batches', :as => :feed
  resources :courses
  resources :batches do
    resources :exam_groups
    resources :additional_exam_groups
    resources :elective_groups
  end

  resources :exam_groups do
    resources :exams do
      member do
        post :save_scores
      end
    end
  end

  resources :additional_exam_groups do
    resources :additional_exams do
      member do
        post :save_additional_scores
      end
    end
  end

  match '/' => 'users#login'
  match '/:controller(/:action(/:id))'
  match ':controller/:action/:id/:id2' => '#index'
0

精彩评论

暂无评论...
验证码 换一张
取 消