def normalize_options(options)
      error_message = "invalid options, use :only or :except, :if or :unless"
      return [[:except, nil], [:if, true]] if options.blank?

      raise ArgumentError, error_message unless options.instance_of?(Hash)

      scope = [:only, :except] & options.keys
      condition = [:if, :unless] & options.keys

      raise ArgumentError, error_message unless (options.keys - [:only, :except, :if, :unless]).empty?
      raise ArgumentError, error_message if scope.size > 1 || condition.size > 1

      scope = scope.first || :except
      actions = options[scope]
      actions = [actions] unless actions.instance_of?(Array)
      actions = actions.collect{ |action| action.try(:to_s) }

      condition = condition.first || :if

      if options.has_key?(condition)
        condition_value = options[condition]
      else
        condition_value = true
      end

      [[scope, *actions], [condition, condition_value]]
    end
def normalize_options(options)
      error_message = "invalid options, use :only or :except, :if or :unless"
      return [[:except, nil], [:if, true]] if options.blank?

      raise ArgumentError, error_message unless options.instance_of?(Hash)

      scope = [:only, :except] & options.keys
      condition = [:if, :unless] & options.keys

      raise ArgumentError, error_message unless (options.keys - [:only, :except, :if, :unless]).empty?
      raise ArgumentError, error_message if scope.size > 1 || condition.size > 1

      scope = scope.first || :except
      actions = options[scope]
      actions = [actions] unless actions.instance_of?(Array)
      actions = actions.collect{ |action| action.try(:to_s) }

      condition = condition.first || :if

      if options.has_key?(condition)
        condition_value = options[condition]
      else
        condition_value = true
      end

      [[scope, *actions], [condition, condition_value]]
    end
When specifying which actions param protection apply to, we allow a format like this...
   :only => [:action1, :action2]
 This method normalizes that to...
   [:only, "action1", "action2"]