app/controllers/application_controller.rb
# instantiate_params takes arguments in the form of keys which are then used to find params and turn them into instance variables of the same name/value.
# Arguments can be given a default value by submitting the key in an array. The first element is the key, which is used to search the params. If the params
# do not contain objects matching that key, an instance variable is created with the name of the key, and the value of the second element in the array.
instantiate_params takes arguments in the form of keys which are then used to find params and turn them into instance variables of the same name/value.
Arguments can be given a default value by submitting the key in an array. The first element is the key, which is used to search the params. If the params
do not contain objects matching that key, an instance variable is created with the name of the key, and the value of the second element in the array.
instantiate_params takes arguments in the form of keys which are then used to find params and turn them into instance variables of the same name / value . Arguments can be given a default value by submitting the key in an array . The first element is the key which is used to search the params . If the params do not contain objects matching that key an instance variable is created with the name of the key and the value of the second element in the array .
def instantiate_params *args
    args.each do |arg|
      if arg.class.to_s == 'Array'
        if params[arg[0]].present?
          instance_variable_set("@#{arg[0].to_s}", params[arg[0]])
        else
          instance_variable_set("@#{arg[0].to_s}", arg[1])
        end
        next
      end
      if params[arg].present?
        instance_variable_set("@#{arg.to_s}", params[arg])
      end
    end
  end
def instantiate_params * args args . each do | arg | if arg . class . to_s == 'Array' if params [ arg [ 0 ] ] . present? instance_variable_set ( "@#{arg[0].to_s}" , params [ arg [ 0 ] ] ) else instance_variable_set ( "@#{arg[0].to_s}" , arg [ 1 ] ) end next end if params [ arg ] . present? instance_variable_set ( "@#{arg.to_s}" , params [ arg ] ) end end end
instantiate_params takes arguments in the form of keys which are then used to find params and turn them into instance variables of the same name/value.
instantiate_params takes arguments in the form of keys which are then used to find params and turn them into instance variables of the same name / value .
args
<not_specific>