Mercurial > zeropaste
comparison app/controllers/pastes_controller.rb @ 283:200488650a86
flash.now !!
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 16 Oct 2013 04:00:09 +0900 |
parents | 6cca1ab53337 |
children | 61f7f258a6fb |
comparison
equal
deleted
inserted
replaced
282:4411631db561 | 283:200488650a86 |
---|---|
46 if @paste.save | 46 if @paste.save |
47 @fresh = true | 47 @fresh = true |
48 format.html { redirect_to @paste, :notice => 'Paste was successfully created.' } | 48 format.html { redirect_to @paste, :notice => 'Paste was successfully created.' } |
49 format.json { render :json => @paste, :status => :created, :location => @paste } | 49 format.json { render :json => @paste, :status => :created, :location => @paste } |
50 else | 50 else |
51 flash[:alert] = @paste.errors.full_messages.to_sentence | 51 flash.now[:alert] = @paste.errors.full_messages.to_sentence |
52 format.html { render :action => "new" } | 52 format.html { render :action => "new" } |
53 format.json { render :json => @paste.errors, :status => :unprocessable_entity } | 53 format.json { render :json => @paste.errors, :status => :unprocessable_entity } |
54 end | 54 end |
55 format.txt | 55 format.txt |
56 end | 56 end |
68 @paste = Paste.safe_find(params[:id]) | 68 @paste = Paste.safe_find(params[:id]) |
69 if @paste.safe_destroy(params[:paste][:key]) | 69 if @paste.safe_destroy(params[:paste][:key]) |
70 expire_page :controller => 'pastes', :action => 'show', :id => @paste.id | 70 expire_page :controller => 'pastes', :action => 'show', :id => @paste.id |
71 redirect_to root_path, :notice => "Paste ##{params[:id]} deleted" | 71 redirect_to root_path, :notice => "Paste ##{params[:id]} deleted" |
72 else | 72 else |
73 flash[:alert] = @paste.errors.full_messages.to_sentence | 73 flash.now[:alert] = @paste.errors.full_messages.to_sentence |
74 render :show | 74 render :show |
75 end | 75 end |
76 end | 76 end |
77 | 77 |
78 private | 78 private |