rubyforgood / pet-rescue

Pet Rescue is an application making it easy to link adopters/fosters with pets. We work with grassroots pet rescue organizations to understand how we can make the most impact.
MIT License
57 stars 95 forks source link

Rename Question to CustomForm::Question #838

Closed kasugaijin closed 1 month ago

kasugaijin commented 2 months ago

Question should be renamed to CustomForm::Question. This means renaming all areas in the app (model, controller, policies, views, tests, variables, methods etc.). It should be a relatively straightforward find and replace.

Note the table does not need to be renamed. The CustomForm scope helps to organize this resource along with others that are similar.

please nest the modules and classes instead of inline: https://thoughtbot.com/blog/why-you-should-nest-modules-in-ruby we are trying to move to the nested format throughout.

Any questions - comment below!

sarvaiyanidhi commented 2 months ago

Hi @kasugaijin, I can take up this issue. Can you please assign it to me? Thanks Nidhi

sarvaiyanidhi commented 2 months ago

Hey @kasugaijin,

One quick question, are you also looking to add module custom_form for controller as well as we already have question route nested under forms

resources :forms do
   resources :questions
 end

Do you also want it to be nested under custom_form namespace which will become

resources :forms do
    namespace :custom_form do
        resources :questions
    end
end

So, current URL will become from http://localhost:3000/alta/staff/forms/1/questions/1/edit to http://localhost:3000/alta/staff/forms/1/custom_form/questions/1/edit

Can you confirm on this?

Thanks Nidhi

kasugaijin commented 1 month ago

So we will want to use CustomForm as a scope for all form related resources so please make it CustomForm::Form::…

thanks @sarvaiyanidhi

sarvaiyanidhi commented 1 month ago

Thanks @kasugaijin .. Can I also make changes for Form to CustomForm::Form in this PR itself along with changes for CustomForm::Question?

kasugaijin commented 1 month ago

Yes that makes sense to do in one PR. @sarvaiyanidhi Also, we will again refactor the SubmittedAnswer model you worked on recently as we have changed direction slightly architecturally and need that model to be more generalized to accept data from multiple inputs, not just the custom form. Just letting you know now in case you wonder why there will be an issue to change this :)

sarvaiyanidhi commented 1 month ago

Sure.. Thanks for the heads up