Module: ValidatableAssociations

Includes:
Association, Confirmation, MassAssignment
Defined in:
lib/validatable_associations.rb,
lib/validatable_associations/has_one.rb,
lib/validatable_associations/association.rb,
lib/validatable_associations/confirmation.rb,
lib/validatable_associations/mass_assignment.rb

Overview

ValidatableAssociations

ValidatableAssociations is a Rails plugin and add-on to Jay Fields Validatable library. This add-on lets you specify associations to other validatable Classes and allows you to set up a decent validatable structure.

Defined Under Namespace

Modules: Association, ClassMethods, Confirmation, HasOne, MassAssignment

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Association

#valid?

Methods included from MassAssignment

#initialize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object

Catches calls to undefined methods. Checks if the method called matches a reader/writer method of an association and handles the read/write process. Delegates to super otherwise.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/validatable_associations.rb', line 25

def method_missing(method, *args)
  method = clean_method_name(method)

  if association? method
    handle_association(method, args[0])
  elsif confirmation? method
    handle_confirmation(method, args[0])
  else
    super
  end
rescue NameError
  super
end

Class Method Details

.included(base) ⇒ Object

:nodoc:



18
19
20
# File 'lib/validatable_associations.rb', line 18

def self.included(base) #:nodoc:
  base.extend(ClassMethods)
end