Goalie
Goalie

Reputation: 3105

Would it be better to create an entirely new action in my controller or should I create a new controller in Ruby on Rails?

Basically I have an existing CollegeClass Controller that has the default basic RESTful actions like show for showing the webpage for that college class,edit for editing, and update for the post action of editing the page itself. I need to add an additional single "About the class" webpage to this resource which will not add another model. It will just add another field to the existing CollegeClass table for the html that will present the new page.

Should I create a controlller exclusive to the "About the class"? Or should I add on into the CollegeClass controller new actions? Or do I need to nest this?

Thanks for your help

Upvotes: 0

Views: 56

Answers (1)

Yuriy Goldshtrakh
Yuriy Goldshtrakh

Reputation: 2014

I would go with the custom action and just route it inside college routes as

resources :colleges do
  member do
    get 'about'
  end
end


CollegeController < ApplicationController
  def about
  end
end

Upvotes: 1

Related Questions