Sha256: 15fd09d763974d377eb89098af719cd0f6ff6e868edb9a711244d486d172b5b7

Contents?: true

Size: 471 Bytes

Versions: 5

Compression:

Stored size: 471 Bytes

Contents

require 'rails_admin/config/model'

module RailsAdmin
  module Config
    class LazyModel
      def initialize(entity, &block)
        @entity = entity
        @deferred_block = block
      end

      def method_missing(method, *args, &block)
        if !@model
          @model = RailsAdmin::Config::Model.new(@entity)
          @model.instance_eval(&@deferred_block) if @deferred_block
        end

        @model.send(method, *args, &block)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rails_admin-lbgraham-0.4.2 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.3 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.2 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.1 lib/rails_admin/config/lazy_model.rb
rails_admin-0.4.0 lib/rails_admin/config/lazy_model.rb