divert 0.0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/divert/version.rb +1 -1
- data/lib/divert.rb +12 -6
- metadata +2 -2
data/lib/divert/version.rb
CHANGED
data/lib/divert.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require "divert/engine"
|
2
2
|
|
3
3
|
module Divert
|
4
|
-
def
|
5
|
-
|
6
|
-
|
4
|
+
def action_missing path
|
5
|
+
puts "DIVERTIO!"
|
6
|
+
path ||= params[:path]
|
7
|
+
if action_methods.include? path
|
8
|
+
puts "SENDING METHOD: #{path}"
|
9
|
+
send path and return
|
7
10
|
end
|
8
11
|
|
9
|
-
if
|
10
|
-
|
12
|
+
if template_exists?(path, [controller_name])
|
13
|
+
puts "RENDERING METHOD: #{path}"
|
14
|
+
render "#{controller_name}/#{path}" and return
|
11
15
|
end
|
12
16
|
|
13
17
|
if (redirect = Redirect.hit request.fullpath)
|
@@ -16,12 +20,14 @@ module Divert
|
|
16
20
|
unless template_exists? 'divert', [controller_name]
|
17
21
|
render text:"Missing divert view: #{controller_name}/divert.html.erb" and return
|
18
22
|
end
|
23
|
+
render "#{controller_name}/divert" and return
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
23
28
|
class ActionDispatch::Routing::Mapper
|
24
29
|
def divert_with controller
|
25
|
-
match
|
30
|
+
match ":action" => "static"
|
31
|
+
match '*path' => "#{controller}#action_missing", :format => false
|
26
32
|
end
|
27
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: divert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|