I have many groups and each group has one timetable and I wish to retrieve the timetable for a particular group and have a method called get_timetable_for_group
, then where should this method go to? Inside the groupscontroller
or the timetablescontroller
as get_timetable_for_group
is a complex method.
Currently I use this in my routes.rb
resources :groups do
resource :timetable
collection do
get 'get_group_code'
get 'get_group_name'
get 'find_by_name'
end
end
so should I add get 'find_timetable" also inside collection? And have a method inside groupscontroller as
def find_timetable
#complex logic
end
or inside the timetablescontroller as
def find_timetable_for_group
#complex logic
end