active_record_api-rest 1.0.22 → 1.0.23

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: ff6756954ff6e7850e0752d0cd93ec08c9dfa24d19b561ff596da81a7da0a731
4
- data.tar.gz: de5097a542640c0d61f358961b1f4491b125f16cfbc0becb96826777f4cde420
3
+ metadata.gz: 731b4376a9b6a9554968df8bc13f8489153c5f526790a494627ff0abebfcc2e8
4
+ data.tar.gz: cc7cec74d8fbbf6dd9e29df2b95c1091b2f85640123aff159327b9f6361997c5
5
5
  SHA512:
6
- metadata.gz: c1f4535211bad38775aa6c538765d39fe74ae42fffca97fadc75fa2b244fe732ea0be647f715804a13fb2cc5f10a8ab47163428ad8147cbcf8b1d09853b67f11
7
- data.tar.gz: 4d8ad1f62e00c338c2f0233ea3f7b048ed2962f9c0414ec83de21b29c5354817311127899629c94612d5bed0f86fe972106ae44e807c5b19a9f0e1a202a6ac21
6
+ metadata.gz: 7f17acf6b275fdd0427cd9af56cc08c8b8b8e221f7a07155dce0578ce0a4b5e77faad8052b43048f5b9133d3ad590a19c1b2c3766a506b3b0995147e2539aa33
7
+ data.tar.gz: c7695d96bac9774c3ed7649fee44696ec388ce089fe3386fa4fdff6e693d0deb7bec2a3c5d9dbdc926d1d0b81f4018cd87845316ef3ea8f1485f7465d4abf8bd
@@ -12,7 +12,6 @@ module ActiveRecordApi
12
12
  autoload :VERSION
13
13
  module Auth
14
14
  extend ActiveSupport::Autoload
15
- autoload :Policy
16
15
  autoload :Scope
17
16
  autoload :AccessDeniedException
18
17
  autoload :BadSessionException
@@ -3,7 +3,7 @@ module ActiveRecordApi
3
3
  class Controller < ApplicationController
4
4
  include GracefulErrors
5
5
  delegate :previous_id, :limit, :queryable_params, :modifiable_params, :not_allowed_params, to: :parameters
6
- delegate :next_url, to: :request_url_generator
6
+ delegate :next_url, :redirect_url, to: :request_url_generator
7
7
  before_action :initialize_model, only: :create
8
8
  before_action :validate_params
9
9
 
@@ -19,7 +19,7 @@ module ActiveRecordApi
19
19
 
20
20
  def create
21
21
  if model.save
22
- render json: model, serializer: serializer
22
+ redirect_to redirect_url(model), status: :see_other
23
23
  else
24
24
  render json: model.errors, status: :unprocessable_entity
25
25
  end
@@ -27,7 +27,7 @@ module ActiveRecordApi
27
27
 
28
28
  def update
29
29
  if model.update(modifiable_params)
30
- render json: model, serializer: serializer
30
+ redirect_to redirect_url(model), status: :see_other
31
31
  else
32
32
  render json: model.errors, status: :unprocessable_entity
33
33
  end
@@ -17,6 +17,14 @@ module ActiveRecordApi
17
17
  "#{current_url}?#{new_params.to_param}"
18
18
  end
19
19
 
20
+ def redirect_url(model)
21
+ if action_name == 'update'
22
+ current_url
23
+ else
24
+ "#{current_url}/#{model.id}"
25
+ end
26
+ end
27
+
20
28
  def new_params
21
29
  query_parameters.dup.merge(pagination_param_name.to_s => models_remaining.limit(limit).last.send(pagination_param_name))
22
30
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecordApi
4
4
  module Rest
5
- VERSION = '1.0.22'.freeze
5
+ VERSION = '1.0.23'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_api-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.22
4
+ version: 1.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Full Measure Education
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-22 00:00:00.000000000 Z
11
+ date: 2019-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler