active_scaffold_duplicate 1.1.3 → 1.2.0

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: 47c6903bcee8b8ceb19663f449ee1145d5dc7f983164a9a48b44dc5677ed4d73
4
- data.tar.gz: 28d7372890e6a0ce5f0002f454307063a49e4913f803fc766293fbb02189569e
3
+ metadata.gz: '000090db88809b6c86fb027ca9e576358265ff88f4b9db0a98c730d76792c5b4'
4
+ data.tar.gz: f3469b5d01868324d55d6380e3d18447a61567294310617ba5554cfb166087d3
5
5
  SHA512:
6
- metadata.gz: 81a79847ad92fc3367aa63dfda76e0e78ae71080d0f9f7713b24263ec072c8dbb9894479b82fe1da2b404b906de4b230a9c86f0628772d450230ece869939dc5
7
- data.tar.gz: 86a94b7a382803f0e83c2e4e14d2d90bdae5cc472ad5363b615aae76395382fa1c505533013b00824d8e0ee7e22d012e46ee6b34ec1342ec4d276fef18b5a647
6
+ metadata.gz: 8fef7c1494886ea04da287b43937ab8d7c0ff24ceae01b41a85b24cd621905667136310824640e0ee1c0ab4eb9b7f6b15d4cbe35c3f823294d659a14f35b9bb8
7
+ data.tar.gz: 6255e504a1dd6c87bf450e97913cd40dc0b9f16619f5879fbe4bfa0205d0ead5786f01179966047c25076a248568d96235cfb68f2e609c1e2ef92353f4b79215
@@ -5,7 +5,7 @@ module ActiveScaffold::Actions
5
5
  end
6
6
 
7
7
  def duplicate
8
- @old_record = find_if_allowed(params[:id], :read)
8
+ @old_record = find_if_allowed(params[:id], crud_type: :read, action: :duplicate)
9
9
  @record = @old_record.send(active_scaffold_config.duplicate.method)
10
10
  if request.post?
11
11
  before_duplicate_save(@record)
@@ -25,7 +25,7 @@ module ActiveScaffold::Actions
25
25
  def after_duplicate_save(record); end
26
26
 
27
27
  def duplicate_authorized?(record = nil)
28
- (record || self).authorized_for?(:crud_type => :create, :action => :duplicate)
28
+ (record || self).authorized_for?(crud_type: :create, action: :duplicate, reason: true)
29
29
  end
30
30
 
31
31
  def duplicate_respond_to_html
@@ -61,7 +61,7 @@ module ActiveScaffold::Actions
61
61
  private
62
62
  def duplicate_authorized_filter
63
63
  link = active_scaffold_config.duplicate.link || active_scaffold_config.duplicate.class.link
64
- raise ActiveScaffold::ActionNotAllowed unless self.send(link.security_method)
64
+ raise ActiveScaffold::ActionNotAllowed unless Array(send(link.security_method))[0]
65
65
  end
66
66
  def duplicate_formats
67
67
  (default_formats + active_scaffold_config.formats + active_scaffold_config.duplicate.formats).uniq
@@ -1,9 +1,14 @@
1
1
  module ActiveScaffoldDuplicate
2
2
  class Engine < ::Rails::Engine
3
- initializer "active_scaffold.action_view" do |app|
3
+ initializer "active_scaffold_duplicate.action_view" do |app|
4
4
  ActiveSupport.on_load :action_view do
5
5
  include ActiveScaffold::Helpers::DuplicateHelpers
6
6
  end
7
7
  end
8
+ initializer 'active_scaffold_duplicate.routes' do
9
+ ActiveSupport.on_load :active_scaffold_routing do
10
+ self::ACTIVE_SCAFFOLD_CORE_ROUTING[:member][:duplicate] = [:post, :get]
11
+ end
12
+ end
8
13
  end
9
14
  end
@@ -1,8 +1,8 @@
1
1
  module ActiveScaffoldDuplicate
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
5
- PATCH = 3
4
+ MINOR = 2
5
+ PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -1,4 +1,3 @@
1
- require "active_scaffold_duplicate/config/core.rb"
2
1
  require "active_scaffold_duplicate/engine.rb"
3
2
 
4
3
  module ActiveScaffoldDuplicate
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_duplicate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-13 00:00:00.000000000 Z
11
+ date: 2024-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.6.0.pre
19
+ version: 3.7.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.6.0.pre
26
+ version: 3.7.1
27
27
  description: Clone records using a method from model in ActiveScaffold
28
28
  email: activescaffold@googlegroups.com
29
29
  executables: []
@@ -41,14 +41,13 @@ files:
41
41
  - lib/active_scaffold/config/duplicate.rb
42
42
  - lib/active_scaffold/helpers/duplicate_helpers.rb
43
43
  - lib/active_scaffold_duplicate.rb
44
- - lib/active_scaffold_duplicate/config/core.rb
45
44
  - lib/active_scaffold_duplicate/engine.rb
46
45
  - lib/active_scaffold_duplicate/version.rb
47
46
  homepage: http://github.com/activescaffold/active_scaffold_duplicate
48
47
  licenses:
49
48
  - MIT
50
49
  metadata: {}
51
- post_install_message:
50
+ post_install_message:
52
51
  rdoc_options: []
53
52
  require_paths:
54
53
  - lib
@@ -63,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
62
  - !ruby/object:Gem::Version
64
63
  version: '0'
65
64
  requirements: []
66
- rubyforge_project:
67
- rubygems_version: 2.7.9
68
- signing_key:
65
+ rubygems_version: 3.2.3
66
+ signing_key:
69
67
  specification_version: 4
70
68
  summary: Clone record gem for Activescaffold
71
69
  test_files: []
@@ -1,4 +0,0 @@
1
- # Need to open the AS module carefully due to Rails 2.3 lazy loading
2
- ActiveScaffold::Config::Core.class_eval do
3
- ActiveScaffold::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member][:duplicate] = [:post, :get]
4
- end