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.
@@ -1,5 +1,5 @@
1
1
  module FlexibleApiServer
2
2
 
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
 
5
5
  end
@@ -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(options)
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(options)
165
+ free_render 200, query.find_all_hash(:request_level => requested_level)
167
166
  end
168
167
  end
169
168
  end
@@ -89,13 +89,15 @@
89
89
  </div>
90
90
  <% end %>
91
91
 
92
- <% unless true || model[:associations].empty? %>
92
+ <% unless (associations = model.reflect_on_all_associations).empty? %>
93
93
  <div class="associations">
94
- <% model[:associations].each do |assoc| %>
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[:name]}" %>
97
- <% unless assoc[:name].to_s == assoc[:type] %>
98
- <%= "(type: #{assoc[: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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Crepezzi