shim 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,9 @@ class Shim::PagesController < ActionController::Base
4
4
 
5
5
  rescue_from ActionView::MissingTemplate do |exception|
6
6
  if exception.message =~ %r{Missing template #{content_path}}
7
- raise ActionController::RoutingError, "No such page: #{params[:id]}"
7
+ # There's probably a better way to put both of these in the same handler,
8
+ # but unless is the best I can com up with for now.
9
+ raise ActionController::RoutingError, "No such page: #{params[:id]}" unless try_index
8
10
  else
9
11
  raise exception
10
12
  end
@@ -28,4 +30,10 @@ class Shim::PagesController < ActionController::Base
28
30
  def content_path
29
31
  ::Shim.content_path
30
32
  end
33
+
34
+ def try_index
35
+ render :template => "#{current_page}/index"
36
+ rescue ActionView::MissingTemplate
37
+ false
38
+ end
31
39
  end
data/lib/shim/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shim
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-25 00:00:00.000000000 Z
13
+ date: 2012-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails