title: Rails 4: how to check if an instance has been deleted
body: <p>In our Rails app, we have a <code>CalendarsController</code>:</p>
  
  <pre><code>class CalendarsController &lt; ApplicationController
  
    def create
      @calendar = current_user.calendars.create(calendar_params)
      current_user.add_calendar_and_role(@calendar.id, 'Owner')
      if @calendar.save
        current_user.total_calendar_count += 1
        current_user.owned_calendar_count += 1
        current_user.save
        flash[:success] = "Calendar created!"
        redirect_to dashboard_path
      else
        render 'static_pages/home'
      end
    end
  
    def show
      @calendar = Calendar.find(params[:id])
      @posts = @calendar.posts
      @post = Post.new
    end
  
    def index
    end
  
    def edit
    end
  
    def destroy
      Calendar.find(params[:id]).destroy
      flash[:success] = "Calendar deleted"
      redirect_to dashboard_path
    end
  
    private
  
      def calendar_params
        params.require(:calendar).permit(:name)
      end
  
  end
  </code></pre>
  
  <p>In the <code>create</code> action, when a new @calendar is created, we run <code>@calendar.save</code> to check if the new instance has actually been created, and then perform some actions.</p>
  
  <p>We would like to implement a similar process in our <code>destroy</code> action.</p>
  
  <p>We are thinking of updating the <code>destroy</code> method as follows:</p>
  
  <pre><code>def destroy
    @calendar = Calendar.find(params[:id])
    @calendar.destroy
    if @calendar.delete
      flash[:success] = "Calendar deleted"
      current_user.total_calendar_count -= 1
      if @calendar.administrations.role == "Owner"
        current_user.owned_calendar_count -= 1
      end
    end
    redirect_to dashboard_path
  end
  </code></pre>
  
  <p>Is the syntax of this code correct, in particular <code>if @calendar.delete</code> and <code>if @calendar.administrations.role == "Owner"</code>?</p>
  
  <p>And, most importantly, would the code of this <code>destroy</code> action make sense?</p>