i was wondering if anyone can help me form a very simple “if” statment
in the controller…
i did a usual scaffold for table ‘pages’, and everything is working out
well, i did the main site ‘backbone’ and all, and everythings
good…the thing is, now i need to make sure that the site-admin does
not have the possiblity to destroy page 1 or page 2.
so, i tried a couple things myself(added onto the ‘destroy’ action in
the scaffold defualt) but it didn’t really work out for me…what am i
doing wrong? is there a different way to solve this?
redirect_to :action => ‘list’
and this is my try
if params[:id] == 1 flash[:notice] = 'you cannot destroy this page' redirect_to :action => 'list' else Page.find(params[:id]).destroy redirect_to :action => 'list'
why isn’t this working?
any help will be greatly appreciated.
thanks ahead of time,