Skip to content
This repository has been archived by the owner on Aug 14, 2018. It is now read-only.

Commit

Permalink
prefer .js in posts#create
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Apr 26, 2010
1 parent 4bdd9fc commit 107fc90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/controllers/posts_controller.rb
Expand Up @@ -25,25 +25,25 @@ def create
if params[:commit] == "Preview"
current_object.valid?
respond_to do |format|
format.js { render :partial => 'preview', :locals => {:post => current_object} }
format.html do
flash[:notice] = 'Create successful!'
redirect_to post_path(current_object)
redirect_to posts_path
end
format.js { render :partial => 'preview', :locals => {:post => current_object} }
end
else
if current_object.save
respond_to do |format|
format.js { render :partial => 'post', :locals => {:post => current_object} }
format.html do
flash[:notice] = 'Create successful!'
redirect_to post_path(current_object)
end
format.js { render :partial => 'post', :locals => {:post => current_object} }
end
else
respond_to do |format|
format.html { render :action => "new" }
format.js { render :text => current_object.errors.full_messages.join(', ').capitalize, :status => 403 }
format.html { render :action => "new" }
end
end
end
Expand Down

0 comments on commit 107fc90

Please sign in to comment.