app/controllers/form_creation/posts_controller.rb
def update   
      @post = Post.find(params[:id])   
      if @post.update_attributes(post_params)   
        flash[:notice] = 'Post updated!'   
        redirect_to posts_path   
      else   
        flash[:error] = 'Failed to edit Post!'   
        render :edit   
      end   
    end
# PUT method for updating in database a Post based on id   
PUT method for updating in database a Post based on id
PUT method for updating in database a Post based on id
def update   
      @post = Post.find(params[:id])   
      if @post.update_attributes(post_params)   
        flash[:notice] = 'Post updated!'   
        redirect_to posts_path   
      else   
        flash[:error] = 'Failed to edit Post!'   
        render :edit   
      end   
    end
def update @post = Post . find ( params [ :id ] ) if @post . update_attributes ( post_params ) flash [ :notice ] = 'Post updated!' redirect_to posts_path else flash [ :error ] = 'Failed to edit Post!' render :edit end end
PUT method for updating in database a Post based on id
PUT method for updating in database a Post based on id