wvanbergen-http_status_exceptions 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -19,6 +19,24 @@ Installation is simple. Simply add the gem in your <tt>environment.rb</tt>:
19
19
 
20
20
  Run <tt>rake gems:install</tt> to install the gem if needed.
21
21
 
22
+ == Configuration
23
+
24
+ You can modify where HTTP status exception looks for its template files like so:
25
+
26
+ class ApplicationController < ActionController::Base
27
+ ...
28
+ HTTPStatus::Base.template_path = 'path_to/http_status_templates'
29
+ end
30
+
31
+ You can also modify which layout is used when rendering a template by setting the <tt>template_layout</tt>:
32
+
33
+ class ApplicationController < ActionController::Base
34
+ ...
35
+ HTTPStatus::Base.template_layout = 'exception'
36
+ end
37
+
38
+ If you don't set a template_layout the current layout for the requested action will be used.
39
+
22
40
  == Usage
23
41
 
24
42
  class BlogController < ApplicationController
@@ -6,6 +6,9 @@ module HTTPStatus
6
6
  cattr_accessor :template_path
7
7
  @@template_path = 'shared/http_status'
8
8
 
9
+ # The layout in which the error documents are rendered
10
+ cattr_accessor :template_layout
11
+
9
12
  attr_reader :status, :details
10
13
 
11
14
  # Creates the exception with a message and some optional other info.
@@ -41,7 +44,9 @@ module HTTPStatus
41
44
  # with the HTTP status correspodning to the exception.
42
45
  def http_status_exception(exception)
43
46
  @exception = exception
44
- render(:template => exception.template, :status => exception.status)
47
+ render_options = {:template => exception.template, :status => exception.status}
48
+ render_options[:layout] = exception.template_layout if exception.template_layout
49
+ render(render_options)
45
50
  rescue ActionView::MissingTemplate
46
51
  head(exception.status)
47
52
  end
@@ -232,10 +232,10 @@ module Rake
232
232
 
233
233
  def create_version_tag!
234
234
  # commit the gemspec file
235
- git_commit_file(gemspec_file, "Updated #{gemspec_file} for release of version #{@specification.version}") if git_modified?(gemspec_file)
235
+ git_commit_file(gemspec_file, "Released #{@name} version #{@specification.version}") if git_modified?(gemspec_file)
236
236
 
237
237
  # create tag and push changes
238
- git_create_tag("#{@name}-#{@specification.version}", "Tagged version #{@specification.version}")
238
+ git_create_tag("#{@name}-#{@specification.version}", "Tagged #{@name} version #{@specification.version}")
239
239
  git_push('origin', 'master', [:tags])
240
240
  end
241
241
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wvanbergen-http_status_exceptions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-29 00:00:00 -08:00
12
+ date: 2009-03-24 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15