Module: Klastera::ApplicationHelper
- Defined in:
- app/helpers/klastera/application_helper.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/helpers/klastera/application_helper.rb', line 16
def method_missing(method, *args, &block)
if method.to_s.end_with?('_path') or method.to_s.end_with?('_url')
if main_app.respond_to?(method)
main_app.send(method, *args)
else
super
end
else
super
end
end
|
Instance Method Details
#ac_errors_as_html_list(errors) ⇒ Object
3
4
5
6
7
8
9
10
|
# File 'app/helpers/klastera/application_helper.rb', line 3
def ac_errors_as_html_list(errors)
array_as_html_list(
errors.messages.inject([]) do |array,(attr,errors_array)|
array.concat(errors_array)
array
end
)
end
|
#array_as_html_list(array) ⇒ Object
12
13
14
|
# File 'app/helpers/klastera/application_helper.rb', line 12
def array_as_html_list(array)
"<ul style='padding:0;'><li>#{array.join("</li><li>")}</li></ul>".html_safe
end
|
#respond_to?(method, include_priv = false) ⇒ Boolean
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/helpers/klastera/application_helper.rb', line 28
def respond_to?(method, include_priv=false)
if method.to_s.end_with?('_path') or method.to_s.end_with?('_url')
if main_app.respond_to?(method,include_priv)
true
else
super
end
else
super
end
end
|