rhino_project_core 0.21.0.beta.45 → 0.21.0.beta.47

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
  SHA256:
3
- metadata.gz: 2067ef29a2dafd97f80be50db1bd8d96de7826914480ffe7b2455afb3a2c3846
4
- data.tar.gz: 9847bf820bd6b94b0affb6fc0a98778fad403de9b431ab0dc7fa0c4812232a69
3
+ metadata.gz: 06a96de885bbf31a18ef367c6139c3cb78a25f37102a6d980b65fd170c9bc8a2
4
+ data.tar.gz: ec3d9a80aba2a6fdc53692299640d07968c1d157b3ad4b15ea54ccab00431032
5
5
  SHA512:
6
- metadata.gz: 5eceb42ab45721610b6d13f0fe81b8c49db1272b5b5b1f9ff61dfa0aec10980c598832222cd06af2bad04fd693ca34de7acccd6091e205c750bc94569b9d53e6
7
- data.tar.gz: 807591098866d30ea4843849292f5efe54ac4e44e486775039403eb4a1f4e3a58fa80eed31f6e0c61e2a42334b030b45c882f1c7cc0a5a69a85599a9c151a2ad
6
+ metadata.gz: 63b1fa716e6bf30d664d18376b73885cdaf1505752f7b9cc68854a2d1e4a08b997b1e3c5e3b2684aac108c957e566a8e82e70be46dbf2e49c6219023044785c5
7
+ data.tar.gz: 9bdbb9d79a108d6920a2c3e5a0ac53fedb11bb7d006b910ca4a26893d6d7cdc713ec2d26f55c5e3c6410d4a07f00c7264b1923aa7f757ab3d653c62b994133eb
@@ -23,14 +23,16 @@ module Rhino
23
23
 
24
24
  rescue_from ActiveRecord::RecordNotFound, with: :not_found
25
25
 
26
- def handle_uncaught_error(exception)
26
+ def handle_uncaught_error(e)
27
+ raise e if Rails.env.test?
28
+
27
29
  # Send to rollbar if available
28
- Rollbar.error(exception) if defined? Rollbar
30
+ Rollbar.error(e) if defined? Rollbar
29
31
 
30
- logger.error("Internal server error#{exception.class} #{exception.message} #{exception.backtrace.join("\n")}")
32
+ logger.error "There was an exception - #{e.class}(#{e.message})"
33
+ logger.error e.backtrace.join("\n")
31
34
 
32
- render json: { errors: ['Internal server error.'] },
33
- status: :internal_server_error
35
+ render json: { errors: ['Internal server error.'] }, status: :internal_server_error
34
36
  end
35
37
 
36
38
  def not_found
@@ -24,6 +24,7 @@ module Rhino
24
24
  include Rhino::Resource::ActiveRecordExtension::Reference
25
25
  include Rhino::Resource::ActiveRecordExtension::Describe
26
26
  include Rhino::Resource::ActiveRecordExtension::Routing
27
+ include Rhino::Resource::ActiveRecordExtension::Owner
27
28
  include Rhino::Resource::ActiveRecordExtension::Params
28
29
  include Rhino::Resource::ActiveRecordExtension::Serialization
29
30
  include Rhino::Resource::ActiveRecordExtension::Search
@@ -89,7 +89,6 @@ module Rhino
89
89
  #
90
90
  def rhino_owner(name, **_options)
91
91
  self.resource_owned_by = name
92
- rhino_policy :global if global_owned?
93
92
  end
94
93
 
95
94
  # Sets rhino_owner[rdoc-ref:rhino_owner] to be the base owner
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'resource/owner'
4
- require_relative 'resource/properties'
5
- require_relative 'resource/reference'
6
- require_relative 'resource/describe'
7
- require_relative 'resource/routing'
8
- require_relative 'resource/params'
9
- require_relative 'resource/serialization'
10
- require_relative 'resource/sieves'
3
+ require_relative "resource/owner"
4
+ require_relative "resource/properties"
5
+ require_relative "resource/reference"
6
+ require_relative "resource/describe"
7
+ require_relative "resource/routing"
8
+ require_relative "resource/params"
9
+ require_relative "resource/serialization"
10
+ require_relative "resource/sieves"
11
11
 
12
- require_relative '../../app/policies/rhino/crud_policy'
12
+ require_relative "../../app/policies/rhino/crud_policy"
13
13
 
14
14
  module Rhino
15
15
  module Resource
@@ -25,7 +25,7 @@ module Rhino
25
25
  include Rhino::Resource::Sieves
26
26
 
27
27
  included do
28
- class_attribute :_policy_class, default: Rhino::CrudPolicy
28
+ class_attribute :_policy_class
29
29
 
30
30
  def owner
31
31
  send self.class.resource_owned_by
@@ -41,7 +41,11 @@ module Rhino
41
41
 
42
42
  class_methods do
43
43
  def policy_class
44
- _policy_class
44
+ self._policy_class ||= begin
45
+ return Rhino::GlobalPolicy if global_owned?
46
+
47
+ Rhino::CrudPolicy
48
+ end
45
49
  end
46
50
 
47
51
  def rhino_policy(policy)
data/lib/rhino/version.rb CHANGED
@@ -10,7 +10,7 @@ module Rhino
10
10
  MAJOR = 0
11
11
  MINOR = 21
12
12
  TINY = 0
13
- PRE = "beta.45"
13
+ PRE = "beta.47"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhino_project_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0.beta.45
4
+ version: 0.21.0.beta.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Rosevear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-24 00:00:00.000000000 Z
11
+ date: 2024-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails