Module: BetterRecord::Authenticatable

Extended by:
ActiveSupport::Concern
Includes:
JWT::ControllerMethods
Defined in:
lib/better_record/concerns/controllers/authenticatable.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/better_record/concerns/controllers/authenticatable.rb', line 12

def method_missing(method, *args)
  begin
    if BetterRecord.attributes[method.to_sym]
      m = method.to_sym
      self.class.define_method m do
        BetterRecord.__send__ m
      end
      BetterRecord.__send__ m
    else
      raise NoMethodError
    end
  rescue NoMethodError
    super(method, *args)
  end
end