ruby on rails - What's the best way to update items that belong to a collection? -
i have section model has many sectiontests. each sectiontest has 'position' attribute.
i creating screen allows user alter position attribute sectiontests in section. i'm updating single attribute of collection.
what best way of doing in routes , controller?
here current routes file :
resources :sections resources :section_tests end
my first thoughts in 'edit' action of 'section_tests' controller, 'edit' used edit attributes of single model.
where put code?
if understand correctly, trying update section linked section_test? use active record callback after_save
in sectiontest model.
Comments
Post a Comment