flexible_api_server 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flexible_api_server/version.rb +1 -1
- data/lib/flexible_api_server.rb +2 -3
- data/views/doc_index.html.erb +7 -5
- metadata +3 -3
data/lib/flexible_api_server.rb
CHANGED
@@ -152,9 +152,8 @@ module FlexibleApiServer
|
|
152
152
|
|
153
153
|
return free_render 200, nil if query.nil?
|
154
154
|
|
155
|
-
options = { :request_level => requested_level }
|
156
155
|
if query.is_a?(ActiveRecord::Base)
|
157
|
-
free_render 200, query.to_hash(
|
156
|
+
free_render 200, query.to_hash(requested_level)
|
158
157
|
else
|
159
158
|
# Scope it
|
160
159
|
query = add_scopes(query, scope_param)
|
@@ -163,7 +162,7 @@ module FlexibleApiServer
|
|
163
162
|
free_render 200, :count => query.count
|
164
163
|
else
|
165
164
|
query = add_limit_and_offset(query)
|
166
|
-
free_render 200, query.find_all_hash(
|
165
|
+
free_render 200, query.find_all_hash(:request_level => requested_level)
|
167
166
|
end
|
168
167
|
end
|
169
168
|
end
|
data/views/doc_index.html.erb
CHANGED
@@ -89,13 +89,15 @@
|
|
89
89
|
</div>
|
90
90
|
<% end %>
|
91
91
|
|
92
|
-
<% unless
|
92
|
+
<% unless (associations = model.reflect_on_all_associations).empty? %>
|
93
93
|
<div class="associations">
|
94
|
-
<%
|
94
|
+
<% associations.each do |assoc| %>
|
95
|
+
<% next unless FlexibleApi.flexible_models.include?(assoc.klass) %>
|
96
|
+
<% type = assoc.klass.name.pluralize.underscore.downcase %>
|
95
97
|
<div class="association">
|
96
|
-
<%= "/#{assoc
|
97
|
-
<% unless assoc
|
98
|
-
<%= "(type: #{
|
98
|
+
<%= "/#{assoc.name}" %>
|
99
|
+
<% unless assoc.name.to_s == type %>
|
100
|
+
<%= "(type: #{type})" %>
|
99
101
|
<% end %>
|
100
102
|
</div>
|
101
103
|
<% end %>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexible_api_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Crepezzi
|