Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # fake ActiveRecord model to trigger validation errors on for flagging tool form
- class ContentFlagging < ActiveRecord::Base
- # if I don't define my own init method, this class throws an Mrelation Not Found error (table? what table?)
- def initialize
- end
- attr_accessor :original_location
- attr_accessor :offending_location
- attr_accessor :comments
- attr_accessor :email
- validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
- validates_presence_of :offending_location
- validates_format_of :offending_location, :with => /\/tm\/\d+\//, :message => "doesn't appear to be a valid Helium Knowledge article/URL."
- validates_length_of :comments, :maximum=>100
- end
- class Plagiarism < ContentFlagging
- validates_presence_of :original_location
- validates_format_of :original_location, :with => /^http:\/\//i
- end
- class Inappropriate < ContentFlagging
- end
Add Comment
Please, Sign In to add comment