ocean-rails 5.5.4 → 5.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9637983e267669c5b662b9bf37dfb1b07c414e11
4
- data.tar.gz: 13378c3e4654918727df6ac2799a32205e33b054
3
+ metadata.gz: 0c0d4fe8dcd55f095e2e21d3da13cbb27a067d3d
4
+ data.tar.gz: d7f773d3e392636ccfea0e547070760014749d3f
5
5
  SHA512:
6
- metadata.gz: e5255bd7807561486a10dbc7064b7bc653c0a0bcb9c186d14edfab72bbea495709efd233bde18f2259444c00f91704b2206fa82aa18a944b0a4e55335cc1348f
7
- data.tar.gz: e85ac61eb38c0ab5f8594eef0c9eb03d86dbcb911ff77af5f6a93fe136b7ed342d596c7bacb24919985add39db1f9257085157b2bdeac5ad8c440743505b29fe
6
+ metadata.gz: 285c28a1d6c6073807c5e8946cb886182df341880d9de2cc2f98c082f42c88786736deaa46be355b2e3659a450bd6f72b0e1ba8adddcf4fd8e25b0da246e80b1
7
+ data.tar.gz: 0479aca4787c429c56ed1665b2618f44d28fc44949fc688b88f6831d600f5d091414b5f648ff7c3ea56e11596f101742f4e3f208782fcec68e0b6dcab8354430
@@ -159,7 +159,7 @@ module OceanApplicationController
159
159
  # their standard position, begin with an underscore, etc. The +ocean+ gem generator
160
160
  # for resources creates a partial in the proper location.
161
161
  #
162
- def api_render(x, new: false, href: url_for(params), override_partial: false)
162
+ def api_render(x, new: false, href: x.present? && url_for(params), override_partial: false)
163
163
  if !x.is_a?(Array) && !(defined?(ActiveRecord) && x.is_a?(ActiveRecord::Relation))
164
164
  partial = override_partial || x.to_partial_path
165
165
  if new
@@ -173,9 +173,10 @@ module OceanApplicationController
173
173
  locals: {m.class.model_name.i18n_key => m}) }
174
174
  count = resources.count
175
175
  total_count = x.respond_to?(:unscope) ? x.unscope(:limit, :offset).count : count
176
+ resource_type = x.is_a?(Array) ? x.first && x.first.class.table_name.singularize : x.table_name.singularize
176
177
  attrs = {count: count,
177
178
  total_count: total_count,
178
- resource_type: x.table_name.singularize # We could also go through the class (better)
179
+ resource_type: resource_type
179
180
  }
180
181
  links = {}
181
182
  if href
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "5.5.4"
2
+ VERSION = "5.5.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.4
4
+ version: 5.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson