ActiveRecord 'destroy' method returns a boolean value in Ruby on Rails?

I am using Ruby on Rails 3 and I would like to know what type of return will have the following code:

@user.destroy

I need that to handle cases on success and fault in someway like this:

if @user.destroy
  puts "True"
else
  puts "false"
end

Is it possible? If so, how?

21
задан Nakilon 7 February 2011 в 17:39
поделиться