endpoint 1.0.1 → 1.0.3
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.
@@ -10,6 +10,7 @@ class EndpointControllerGenerator < Rails::Generators::NamedBase
|
|
10
10
|
|
11
11
|
def add_rabl_template
|
12
12
|
actions.reverse.each do |action|
|
13
|
+
@action = action
|
13
14
|
template 'view.rabl', File.join("app/views/", class_path, file_name, "#{action}.rabl")
|
14
15
|
end
|
15
16
|
end
|
@@ -22,4 +23,4 @@ class EndpointControllerGenerator < Rails::Generators::NamedBase
|
|
22
23
|
|
23
24
|
hook_for :test_framework, :in => :rails, :as => :controller
|
24
25
|
hook_for :helper, :in => :rails, :as => :controller
|
25
|
-
end
|
26
|
+
end
|
@@ -1 +1,12 @@
|
|
1
|
-
object
|
1
|
+
<% array_type = ['index', 'all'].include?(@action) %><%= array_type ? 'collection' : 'object' %> @<%= array_type ? table_name : singular_table_name %>
|
2
|
+
<% attributes = ''
|
3
|
+
begin
|
4
|
+
singular_table_name.titlecase.constantize.attr_accessible[:default].each do |attr|
|
5
|
+
attributes += ":#{attr}, " unless attr.empty?
|
6
|
+
end
|
7
|
+
rescue
|
8
|
+
end
|
9
|
+
|
10
|
+
attributes.gsub!(/,\s$/,'')
|
11
|
+
puts "attributes #{attributes}" unless attributes.empty?
|
12
|
+
%>
|