Guest User

Untitled

a guest
Feb 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. # fake ActiveRecord model to trigger validation errors on for flagging tool form
  2. class ContentFlagging < ActiveRecord::Base
  3.  
  4. # if I don't define my own init method, this class throws an Mrelation Not Found error (table? what table?)
  5. def initialize
  6. end
  7.  
  8. attr_accessor :original_location
  9. attr_accessor :offending_location
  10. attr_accessor :comments
  11. attr_accessor :email
  12. validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
  13. validates_presence_of :offending_location
  14. validates_format_of :offending_location, :with => /\/tm\/\d+\//, :message => "doesn't appear to be a valid Helium Knowledge article/URL."
  15. validates_length_of :comments, :maximum=>100
  16.  
  17. end
  18.  
  19. class Plagiarism < ContentFlagging
  20.  
  21. validates_presence_of :original_location
  22. validates_format_of :original_location, :with => /^http:\/\//i
  23.  
  24. end
  25.  
  26. class Inappropriate < ContentFlagging
  27.  
  28. end
Add Comment
Please, Sign In to add comment