Skip to content
  • Jess Bees's avatar
    60f7d490
    Raise error when callback's only/unless symbols aren't methods · 60f7d490
    Jess Bees authored
    When `before_action :callback, only: :action_name` is declared on a
    controller that doesn't respond to `action_name`, raise an exception
    at request time. This is a safety measure to ensure that typos or
    forgetfulness don't prevent a crucial callback from being run when it
    should.
    
    Include names of filters for more useful error messages
    
    The error message of the raised exception will be more useful if it
    indicates the names of the callbacks that have the missing conditinoal
    action.
    
    The way the callbacks get shoehorned into `_normalize_callback_options`
    options parameter is a little awkward, but done this way to avoid
    changing the method's signature, since it is a publicly documented
    method.
    60f7d490
    Raise error when callback's only/unless symbols aren't methods
    Jess Bees authored
    When `before_action :callback, only: :action_name` is declared on a
    controller that doesn't respond to `action_name`, raise an exception
    at request time. This is a safety measure to ensure that typos or
    forgetfulness don't prevent a crucial callback from being run when it
    should.
    
    Include names of filters for more useful error messages
    
    The error message of the raised exception will be more useful if it
    indicates the names of the callbacks that have the missing conditinoal
    action.
    
    The way the callbacks get shoehorned into `_normalize_callback_options`
    options parameter is a little awkward, but done this way to avoid
    changing the method's signature, since it is a publicly documented
    method.
Loading