Module: Snooby::Delete

Included in:
Comment, Post
Defined in:
lib/snooby/actions.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject

Deletes the calling object, which is either a post or a comment, as long as it belongs to the currently authorized user.

Raises:



45
46
47
48
49
50
51
52
53
# File 'lib/snooby/actions.rb', line 45

def delete
  raise RedditError, 'You are not logged in.' unless Snooby.active
  unless self.author == Snooby.active.username
    #raise CommonDecencyError
    raise RedditError, "You can't delete somebody else's content."
  end

  Snooby.request(Paths[:delete], :id => self.name)
end