module GardenVariety::DestroyAction
Public Instance Methods
destroy() { |: redirect_to(action: :index)| ... }
click to toggle source
Garden
variety controller destroy
action. @overload destroy() @overload destroy()
@yield on-success callback, replaces default redirect
@return [void]
# File lib/garden_variety/actions.rb, line 83 def destroy self.model = (model = authorize(find_model)) if model.destroy flash[:success] = flash_message(:success) block_given? ? yield : redirect_to(action: :index) flash.discard(:success) if REDIRECT_CODES.exclude?(response.status) else flash.now[:error] = flash_message(:error) render :show end end