Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > quick RoR question

quick RoR question
Thread Tools
black bear theory
Grizzled Veteran
Join Date: Aug 2005
Location: fairbanks AK
Status: Offline
Reply With Quote
Nov 26, 2007, 01:51 PM
 
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...
Earth First! we'll mine the other planets later.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:23 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,