Class: UserRegistration::Base

Inherits:
Object
  • Object
show all
Defined in:
app/my_lib/user_registration/base.rb

Direct Known Subclasses

UsingBirthday, UsingPassword

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/my_lib/user_registration/base.rb', line 20

def method_missing(method_sym, *arguments, &block)
  if user && user.is_a?(::User)
    if user.respond_to?(method_sym)
      begin
        user.send(method_sym, *arguments, &block)
      rescue ArgumentError
        user.send(method_sym)
      end
    elsif user.has_attribute?(method_sym)
      user.send(method_sym)
    else
      super
    end
  else
    super
  end
end

Instance Method Details

#saveObject



7
8
9
10
11
12
13
14
# File 'app/my_lib/user_registration/base.rb', line 7

def save
  save!
rescue RegistrationError
  false
rescue => e
  report_error_to_rollbar(e)
  false
end

#save!Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'app/my_lib/user_registration/base.rb', line 16

def save!
  raise NotImplementedError
end