Sha256: 5bb4e24ce07b7e43432b1d1206f21936a86fe6b0b885b1da9041befd4d841aa3

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

module AbstractController
  module Assigns
    # This method should return a hash with assigns.
    # You can overwrite this configuration per controller.
    # :api: public
    def view_assigns
      hash = {}
      variables  = instance_variable_names
      variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
      variables.each { |name| hash[name] = instance_variable_get(name) }
      hash
    end

    # This method assigns the hash specified in _assigns_hash to the given object.
    # :api: private
    # TODO Ideally, this should be done on AV::Base.new initialization.
    def _evaluate_assigns(object)
      view_assigns.each { |k,v| object.instance_variable_set(k, v) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
actionpack-3.0.0.beta3 lib/abstract_controller/assigns.rb
actionpack-3.0.0.beta2 lib/abstract_controller/assigns.rb