Class Frgmnt
In: app/models/frgmnt.rb
Parent: ActiveRecord::Base

Methods

validate  

Protected Instance methods

[Source]

    # File app/models/frgmnt.rb, line 13
13:   def validate
14:     case
15:     # Ensure we have some input
16:     when (parent == nil and inputurl == nil)
17:       errors.add(:parent, ", and Input URL are all nil.  You need one.")
18:     # We only want 1 input
19:     when (parent != nil and inputurl != nil)
20:       errors.add(:parent, "and Input URL are both not nil.  A fragment needs 1 (and only 1!)")
21:     # We should not scrape ourself
22:     when (parent == self)
23:       errors.add(:parent, " == self.  Pick a different parent.")
24:     # The controller will set name = "record_usr_id_ne_session_usr_id" if
25:     # I try to update a record I do not own.
26:     when name == "record_usr_id_ne_session_usr_id"
27:       errors.add_to_base "You can only update your records, not other's records."
28:     # display-enumerable needs format like this: table.some-class,[1,5]
29:     when (exprtype.name == 'display-enumerable()' and  ((arg1 =~ /(.*)?(\,)(\[)(\d+)(,)(\d+)(\])$/) != 0))
30:       errors.add(:arg1, ' Problem. display-enumerable() needs format like this: table.some-class,[1,5]')
31:     end # case
32:   end

[Validate]