simplest_view 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -0
- data/lib/simplest_view.rb +6 -4
- data/lib/simplest_view/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -25,6 +25,7 @@ Or install it yourself as:
|
|
25
25
|
1. Inside of your `ApplicationController` or a specific controller: `include SimplestView`
|
26
26
|
2. `mv app/views app/templates`
|
27
27
|
3. mkdir app/views
|
28
|
+
4. append `app/views` to the Rails `autoload_paths` inside of `application.rb`
|
28
29
|
|
29
30
|
Inside of app/views, created directories for each of your controllers. Within each controller directory, create a view to match the actions in your controller.
|
30
31
|
|
data/lib/simplest_view.rb
CHANGED
@@ -6,10 +6,12 @@ module SimplestView
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def view_context_class_name
|
9
|
-
|
10
|
-
|
9
|
+
@_view_context_class_name ||= begin
|
10
|
+
controller = self.class.name.sub(/Controller$/, "").underscore
|
11
|
+
action = action_name + "_view"
|
11
12
|
|
12
|
-
|
13
|
+
File.join(controller, action).camelize
|
14
|
+
end
|
13
15
|
end
|
14
16
|
|
15
17
|
# Rails 3/4
|
@@ -31,7 +33,7 @@ module SimplestView
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
rescue NameError => e
|
34
|
-
Rails.logger.warn "No View defined for #{
|
36
|
+
Rails.logger.warn "No View defined for #{view_context_class_name}"
|
35
37
|
super
|
36
38
|
end
|
37
39
|
end
|