Class: Remotable::WithRemoteModelProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/remotable/with_remote_model_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, remote_model) ⇒ WithRemoteModelProxy

Returns a new instance of WithRemoteModelProxy.



4
5
6
7
# File 'lib/remotable/with_remote_model_proxy.rb', line 4

def initialize(model, remote_model)
  @model = model
  @remote_model = remote_model
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



11
12
13
14
15
# File 'lib/remotable/with_remote_model_proxy.rb', line 11

def method_missing(sym, *args, &block)
  @model.with_remote_model(@remote_model) do
    @model.send(sym, *args, &block)
  end
end