Class: Guise::GuiseForBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/guise/builders.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(association_class, options, association_options) ⇒ GuiseForBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of GuiseForBuilder.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/guise/builders.rb', line 80

def initialize(association_class, options, association_options)
  @association_class = association_class
  @options = options

  # if `:validate` is specified, coerce the value into a boolean, otherwise, default to
  # `true`
  @define_validations = if association_options.key?(:validate)
                          !!association_options.delete(:validate)
                        else
                          true
                        end

  @association_options = @options.default_association_options.merge(association_options)
end

Instance Method Details

#build!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



95
96
97
98
99
100
101
102
103
# File 'lib/guise/builders.rb', line 95

def build!
  update_guise_options!
  define_association!
  define_scopes!

  if define_validations?
    define_validations!
  end
end