I wrote a small controller to find all the expired items and destroy
them:
@listtodestroy=Product.find(:all, :conditions => [‘user_id = ? AND
date_expires <= ?’, @user.id, Time.now])
for product in @listtodestroy
product.destroy
end
It works fine but there’s no warning that everything is about to be
removed like when I call product.destroy on an id instead of array. Is
there a simple way to call the “Are you sure?” dialog for the above?
I wrote a small controller to find all the expired items and destroy
them:
@listtodestroy=Product.find(:all, :conditions => [‘user_id = ? AND
date_expires <= ?’, @user.id, Time.now])
for product in @listtodestroy
product.destroy
end
It works fine but there’s no warning that everything is about to be
removed like when I call product.destroy on an id instead of array. Is
there a simple way to call the “Are you sure?” dialog for the above?
Thanks…
The confirm dialog needs to go on the form button/link that calls the
above controller action. Once the request is fired off to the controller
you have no control over it until it renders/redirects.
The confirm dialog needs to go on the form button/link that calls the
above controller action. Once the request is fired off to the controller
you have no control over it until it renders/redirects.
Bingo. Thank you!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.