aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/action_controller/metal/implicit_render.rb
blob: 99e96a9547bf88d59b0bc2e438c175428fc0a171 (plain) (tree)
1
2
3
4
5
6
7
8
9

                       
                                  
                 
                                      
         

       
                             





                                                                                                          

       



                                                               

       
   
module ActionController
  module ImplicitRender
    def send_action(method, *args)
      ret = super
      default_render unless performed?
      ret
    end

    def default_render(*args)
      if template_exists?(action_name.to_s, _prefixes, variants: request.variant)
        render(*args)
      else
        logger.info "No template found for #{self.class.name}\##{action_name}, rendering head :no_content"
        head :no_content
      end
    end

    def method_for_action(action_name)
      super || if template_exists?(action_name.to_s, _prefixes)
        "default_render"
      end
    end
  end
end