module PivotalTracker::Validation
Public Class Methods
included(klass)
click to toggle source
# File lib/pivotal-tracker/validation.rb, line 32 def self.included(klass) klass.class_eval do instance_methods = klass.instance_methods.map {|name| name.to_sym} if instance_methods.include?(:create) alias_method :create_without_validations, :create alias_method :create, :create_with_validations end if instance_methods.include?(:update) alias_method :update_without_validations, :update alias_method :update, :update_with_validations end end end
Public Instance Methods
create_with_validations()
click to toggle source
# File lib/pivotal-tracker/validation.rb, line 47 def create_with_validations begin create_without_validations rescue RestClient::UnprocessableEntity => e errors.add_from_xml e.response self end end
errors()
click to toggle source
# File lib/pivotal-tracker/validation.rb, line 65 def errors @errors ||= Errors.new end
update_with_validations(attrs={})
click to toggle source
# File lib/pivotal-tracker/validation.rb, line 56 def update_with_validations(attrs={}) begin update_without_validations attrs rescue RestClient::UnprocessableEntity => e errors.add_from_xml e.response self end end