vendor/plugins/assert_request/lib/assert_request.rb
def assert_params_must_have(*args, &block) #:yeilds: name
      safe_assertion do
        param_rules = ParamRules.new(nil, nil, true, true)
        param_rules.must_have(*args, &block)
        param_rules.validate(params)
      end
    end
# Checks the params hash for the given elements, but ignores all other 
# params and other aspects of the request. This allows you to specify a 
# minimum requirement for the params without having to specify all the 
# optional elements. This is useful for before_filters, since a filter
# may use one common parameter, but probably covers several actions, each
# with different request profiles. Here is an example if its use:
# 
#   assert_params_must_have :id, :name
# 
# This verifies that the params hash contains an :id element and a :name
# element, and ignores all other aspects of the request. 
#
# To illustrate the difference between assert_params_must_have and 
# assert_request, here is a similar example of the latter:
# 
#   assert_request do |r| 
#     r.params.must_have :id, :name
#   end
# 
# However, this declaration will complain if there are any elements other 
# than :id and :name in the params hash, whereas assert_params_must_have 
# will not. Both methods raise a RequestError if their criteria are not met.
#   
# This method can be used exactly the same way as ParamRules#must_have ; it
# can take multiple arguments, or it can accept a block to describe nested
# params. See ParamRules#must_have for more detail.
#
Checks the params hash for the given elements, but ignores all other
params and other aspects of the request. This allows you to specify a
minimum requirement for the params without having to specify all the
optional elements. This is useful for before_filters, since a filter
may use one common parameter, but probably covers several actions, each
with different request profiles. Here is an example if its use.



This verifies that the params hash contains an :id element and a :name
element, and ignores all other aspects of the request.

To illustrate the difference between assert_params_must_have and
assert_request, here is a similar example of the latter.

assert_request do |r|
r.params.must_have :id, :name
end

However, this declaration will complain if there are any elements other
than :id and :name in the params hash, whereas assert_params_must_have
will not. Both methods raise a RequestError if their criteria are not met.

This method can be used exactly the same way as ParamRules#must_have ; it
can take multiple arguments, or it can accept a block to describe nested
params.
Checks the params hash for the given elements but ignores all other params and other aspects of the request . This allows you to specify a minimum requirement for the params without having to specify all the optional elements . This is useful for before_filters since a filter may use one common parameter but probably covers several actions each with different request profiles . Here is an example if its use . This verifies that the params hash contains an : id element and a : name element and ignores all other aspects of the request . To illustrate the difference between assert_params_must_have and assert_request here is a similar example of the latter . assert_request do |r| r . params . must_have : id : name end However this declaration will complain if there are any elements other than : id and : name in the params hash whereas assert_params_must_have will not . Both methods raise a RequestError if their criteria are not met . This method can be used exactly the same way as ParamRules#must_have ; it can take multiple arguments or it can accept a block to describe nested params .
def assert_params_must_have(*args, &block) 
      safe_assertion do
        param_rules = ParamRules.new(nil, nil, true, true)
        param_rules.must_have(*args, &block)
        param_rules.validate(params)
      end
    end
def assert_params_must_have ( * args , & block ) safe_assertion do param_rules = ParamRules . new ( nil , nil , true , true ) param_rules . must_have ( * args , & block ) param_rules . validate ( params ) end end
Checks the params hash for the given elements, but ignores all other
params and other aspects of the request.
Checks the params hash for the given elements but ignores all other params and other aspects of the request .
#:yeilds: name
args
block