List Info

Thread: need a warning for destroy all




need a warning for destroy all
user name
2006-08-14 22:40:55
Vince W. wrote:
> 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.

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
need a warning for destroy all
user name
2006-08-14 22:56:17
Luke Redpath wrote:

> 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!

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )