--
Posted via http://www.ruby-forum.com/.
also maybe you can help me out with my problem...do you know how to get
the redbox to appear in the centre of the page? at the moment it seems
stuck to the top of the window...
I don't think that's a valid assumption.
I can envision a whole pile of applications where view, delete, hoojum,
snarf and many other methods in the controller trigger the redbox..
As in
...
record = Page.find(:first, ... param[ whatever ] ..)
begin
if ! record.can_do(action, current_user) then
if current_user.nil? then
Redbox.login("You need to be logged in")
retry
end
Redbox.alert("You don't have permission to #{action} this record")
# don't redisplay anything.
end
...
end
You can argue that things like the 'edit' button should be grayed out
and inoperative if the can_do for it is negative. I can argue that it
shouldn't be and that the controller should respond with a login prompt.
Ultimately its up to the guy paying for the application to decide on the
policy. But I, and I think others, would like to know how to handle it
in the controller pretty much the way I've sketched out and to have
anything in the 'update' or 'render'. Access control issues should be
dealt with earlier.
--
"Cutting the space budget really restores my faith in humanity. It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation." -- Johnny Hart