Class | CommentsController
In: | test/functional/comments_controller_test.rb app/controllers/comments_controller.rb
Parent: | Object

Copyright (c) 2006 Logica

### Methods

destroy edit rescue_action update

### Public Instance methods

destroy()

Action destroy to delete a Comment-record.

[Source]

        # File app/controllers/comments_controller.rb, line 40
    40:   def destroy
    41:     cmt = Comment.find(params[:id])
    42:     wiki = cmt.site
    43:     cmt.destroy
    44:     flash['success'] = ::FLASH_RECORD_DELETED
    45:     redirect_to :controller => 'sites', :action => 'comments', :id => wiki.id
    46:     #redirect_to request.referer TODO If you use this, functional tests will fail
    47:   end

edit()

Action edit to display the edit form

[Source]

        # File app/controllers/comments_controller.rb, line 24
    24:   def  edit
    25:     @comment = Comment.find(params[:id])
    26:   end

rescue_action(e)

[Source]

        # File test/functional/comments_controller_test.rb, line 18
    18:                           def rescue_action(e) raise e end

update()

Action update to update a Comment-record.

[Source]

        # File app/controllers/comments_controller.rb, line 29
    29:   def update
    30:     @comment = Comment.find(params[:id])
    31:     if @comment.update_attributes(params[:comment])
    32:       flash['success'] = ::FLASH_RECORD_UPDATED
    33:       redirect_to @comment.request_referer
    34:     else
    35:       render :action => 'edit'
    36:     end
    37:   end

[Validate]