Changeset 778

Show
Ignore:
Timestamp:
10/27/07 14:53:19 (1 year ago)
Author:
iv..@gweezlebur.com
Message:

add a default 406 information page, and make 404/406 render html by default (app devs can still make format-specific exception handlers)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app_generators/merb/merb_generator.rb

    r694 r778  
    2929      m.file_copy_each %w( application.erb ), "app/mailers/views/layout" 
    3030      m.file_copy_each %w( application.html.erb ), "app/views/layout" 
    31       m.file_copy_each %w( internal_server_error.html.erb not_found.html.erb ), "app/views/exceptions" 
     31      m.file_copy_each %w( internal_server_error.html.erb not_found.html.erb not_acceptable.html.erb ), "app/views/exceptions" 
    3232      m.file_copy_each %w( merb.jpg ), "public/images" 
    3333      m.file_copy_each %w( master.css ), "public/stylesheets" 
  • trunk/app_generators/merb/templates/app/controllers/exceptions.rb

    r640 r778  
    33  # handle NotFound exceptions (404) 
    44  def not_found 
    5     render 
     5    render :format => :html 
     6  end 
     7 
     8  # handle NotAcceptable exceptions (406) 
     9  def not_acceptable 
     10    render :format => :html 
    611  end 
    712 
  • trunk/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb

    r640 r778  
    1313 
    1414    <div id="main-container"> 
    15       <h3>Welcome to Merb!</h3> 
    16       <p>Merb is a light-weight MVC framework written in Ruby.  We hope you enjoy it.</p> 
     15      <h3>Why am I seeing this page?</h3> 
     16      <p>Merb couldn't find an appropriate content_type to return, 
     17        based on what you said was available via provides() and 
     18        what the client requested.  For more information, visit 
     19        http://merbivore.com/fixing_406_issues 
     20      </p>  
    1721       
    1822      <h3>Where can I find help?</h3> 
     
    2226 
    2327      <h3>How do I edit this page?</h3> 
    24       <p>You're seeing this page because you need to edit the following files: 
    25         <ul> 
    26           <li>config/merb.yml <strong><em>(optional)</em></strong></li> 
    27           <li>config/router.rb <strong><em>(recommended)</em></strong></li> 
    28           <li>app/views/exceptions/not_found.html.erb <strong><em>(recommended)</em></strong></li> 
    29           <li>app/views/layout/application.html.erb <strong><em>(change this layout)</em></strong></li> 
    30         </ul> 
    31       </p> 
     28      <p>You can change what people see when this happens byy editing <tt>app/views/exceptions/not_found.html.erb</tt>.</p>  
     29     
    3230    </div> 
    3331