Displaying 1 result from an estimated 1 matches for "to_be_flag".
Did you mean:
no_vbe_flag
2006 Apr 24
2
Checkboxes - Saving a Checked record to another table
...ing
with the logic to save to another table. I know how to do it if the
asset_id is already in the "flagged_assets" table.
# when flag_assets page is loaded
def flag_assets
@assets = Asset.find :all
end
# Called when Ajax form is submitted
def get_flagged
to_flag = params[:to_be_flagged]
if to_flag
to_flag.each do |asset_id, flag|
@assets = FlaggedAsset.find_all_by_asset_id(asset_id)
for asset in @assets
if flag == "yes"
asset.flag = 1
else
asset.flag = 0
end
asset.save!
end...