public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Click here to lend your support to: mack and make a donation at www.pledgie.com !
render() now accepts :status option.
dsutedja (author)
Mon May 05 10:25:45 -0700 2008
commit  9d83491caf90452e3c1b90c5eedaea93c9a1a51c
tree    f031daaad920a556f7006b2a41ec58759919d5ca
parent  cbd604e441bd2d090c290f61744d372d8adf7ec5
...
77
78
79
 
 
80
81
82
...
175
176
177
 
 
 
 
 
 
178
179
180
 
181
182
183
...
77
78
79
80
81
82
83
84
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
0
@@ -77,6 +77,8 @@ module Mack
0
       # An implicit render will happen if one is not specified in the action.
0
       #
0
       # Only :action and :text will get layouts wrapped around them.
0
+ #
0
+ # You can also specify the response status code as part of the options hash.
0
       #
0
       # Examples:
0
       # class MyAwesomeController < Mack::Controller::Base
0
@@ -175,9 +177,16 @@ module Mack
0
       # def get_index
0
       # render(:url => "/")
0
       # end
0
+ #
0
+ # # This will render 'application/404' and set the response status code to 404
0
+ # def to_the_unknown
0
+ # return render(:action => '/application/404', :status => 404)
0
+ # end
0
+ #
0
       # end
0
       def render(options = {:action => self.action_name})
0
         raise Mack::Errors::DoubleRender.new if render_performed?
0
+ response.status = options[:status] unless options[:status].nil?
0
         unless options[:action] || options[:text]
0
           options = {:layout => false}.merge(options)
0
         end

Comments

    No one has commented yet.