Method: Crowdblog::PostsController#update

Defined in:
app/controllers/crowdblog/posts_controller.rb

#updateObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/crowdblog/posts_controller.rb', line 35

def update
  @post = Post.scoped_for(current_user).find(params[:id])
  @post.update_attributes(params[:post], updated_by: current_user)
  if @post.allowed_to_update_permalink?
    @post.regenerate_permalink
    @post.save!
  end

  @post.publish_if_allowed(params[:transition], current_user) if params[:transition]

  respond_with @post
end