rango 0.1.1.2.1 → 0.1.1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rango/controller.rb +12 -12
- data/lib/rango/version.rb +1 -1
- metadata +1 -1
data/lib/rango/controller.rb
CHANGED
@@ -21,23 +21,23 @@ module Rango
|
|
21
21
|
|
22
22
|
def to_response
|
23
23
|
method = self.request.env["rango.controller.action"].to_sym
|
24
|
-
unless
|
25
|
-
raise NotFound, "Controller #{self.name} doesn't have method #{method}"
|
24
|
+
unless self.respond_to?(method) # TODO: what about method_missing?
|
25
|
+
raise NotFound, "Controller #{self.class.name} doesn't have method #{method}"
|
26
26
|
end
|
27
|
-
|
27
|
+
self.run_filters(:before, method.to_sym)
|
28
28
|
# If you don't care about arguments or if you prefer usage of params.
|
29
|
-
if
|
30
|
-
Rango.logger.debug("Calling method #{self.name}##{method} without arguments")
|
31
|
-
|
29
|
+
if self.method(method).arity.eql?(0)
|
30
|
+
Rango.logger.debug("Calling method #{self.class.name}##{method} without arguments")
|
31
|
+
self.response.body = self.method(method).call
|
32
32
|
else
|
33
|
-
args =
|
34
|
-
Rango.logger.debug("Calling method #{self.name}##{method} with arguments #{args.inspect}")
|
35
|
-
|
33
|
+
args = self.params.values
|
34
|
+
Rango.logger.debug("Calling method #{self.class.name}##{method} with arguments #{args.inspect}")
|
35
|
+
self.response.body = self.method(method).call(*args)
|
36
36
|
end
|
37
|
-
|
38
|
-
return
|
37
|
+
self.run_filters(:after, method)
|
38
|
+
return self.response.finish
|
39
39
|
rescue HttpError => exception
|
40
|
-
|
40
|
+
self.rescue_http_error(exception)
|
41
41
|
end
|
42
42
|
|
43
43
|
# for routers
|
data/lib/rango/version.rb
CHANGED