Method: Effective::PostsController#update

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

#updateObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'app/controllers/effective/posts_controller.rb', line 93

def update
  @post ||= Effective::Post.find(params[:id])
  draft_was = @post.draft
  @post.draft = (EffectivePosts.submissions_require_approval == true)

  EffectivePosts.authorize!(self, :update, @post)

  if @post.update_attributes(post_params)
    @page_title ||= 'Post Submitted'
    flash.now[:success] = 'Successfully re-submitted post'

    if EffectivePosts.submissions_require_approval && draft_was != true
      @post.
    end

    render :submitted
  else
    @page_title ||= 'Edit Post'
    flash.now[:danger] = 'Unable to update post'
    render action: :edit
  end
end