i've been playing with ruby on rails and i have a quick question. i have a show and a set model (for music). if a show is deleted, i want each set associated with that show (via an show_id int variable) to be reset to a default value, 1.
this is what i've got in the shows_controller.rb:
def destroy
@musicsets = Musicset.find_all_by_show_id(params[:id])
@musicsets.each do |theset|
theset.show_id = 1
end
Show.find(params[:id]).destroy
redirect_to :action => 'list'
end
it's probably something new since i'm new to ruby...