How to organize actions that are not consistent with normal MVC

I am creating a survey application, so I created a survey controller that leads very calmly, creating, updating, etc. Overview. However, now I am adding other actions to it, such as “take”, conduct a survey, and “share” to share the survey. There are more actions. I'm starting to wonder if I should organize my code differently and move these new actions to my own controllers, however I'm not sure whether to accept or share or some of my other actions really fit in REST really well. They almost make more sense as an action if I was not a bit concerned about the size of the control controller.

Either I could leave it as it is, or I thought about creating a survey namespace and creating, for example, Survey :: TakeController and Survey :: ShareController. Then would I prefer to use a new action or index?

I don’t know exactly how to do it right. If I create a survey space, should I move the original SurveyController into it? This would create some weird methods like survey_survey_path.

+5
source share
2 answers

RESTfully, , , " " ", / .." - - , / .

, - "" - (, - ). (, "MyModel # can_be_edited_by? (Some_user)" ).

, "" , RESTful.

, "" - , - "SurveyResult", "" ", " ", "SurveyResult" ( "SurveyParticipation" - ).

, , , SurveyResults, : : some_user_model.

, :   //123-my_favourite_colour/

RESTful .

- . , ​​ " ". , "". ( ), ( , ), , ?

- SurveyPermission, _ _to: some_user_model. SurveyPermission - Surveys -, . , SurveyPermission. , , SurveyPermission, , , Survey.

- , "create_survey_result (@survey)" -...

Update:

, ( ). , , , , .

- :

map.resources :surveys do |s|
  s.resources :results
  s.resources :shares # ???
end

, :

new_survey_path
surveys_path
new_survey_result_path(@survey)
survey_results_path(@survey)
+5

RESTful, SurveyParticipation, new/create, - . a, , SurveyShare . , !

, , , - . RESTful Rails , .

+1

All Articles