rails_admin_clone 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9236ea8e86153f83d0f1f39ed873248cc3bc167f
4
- data.tar.gz: bb7319860cf320b5564a1c40a7ba3c7aa391417d
3
+ metadata.gz: 34d5f4043dd3a9443e1075cd5f75e86239674f78
4
+ data.tar.gz: a06e877ca03f5aad67a40f58f5565a84848ad061
5
5
  SHA512:
6
- metadata.gz: caf3ee7fd37599ae2e751860a1b9b07d6d7393f99193e19992c189d53cc139c5570980443b0c28e3fa0573ff4d8221b5c9ed0bc17481f557298c4c74ea465107
7
- data.tar.gz: 7e92b2bae810e3c46df799ffb036fdf3003d433d4340cabff3adc5dc37b07b08e64c4707b2fcff291e0794df8213fbdca1dfc28ffc43a366efd6278f5ff2418f
6
+ metadata.gz: 9e9d311118547d8d1f374fcb166eff9c59eb3e9a3e116f2c2f4ab4f458de21cf1afc6795f014564966041134d8366297645b0b45f64990b348771108bb90b415
7
+ data.tar.gz: 3ea3fdcea36474db36398d0369e6e6f0b53c4c0e6854a700d567b04cee0de8a347d031f738efa70a991993ab57ba00a98e33cb020414975a05d6f8d39575af3c
data/README.md CHANGED
@@ -57,7 +57,7 @@ class Post < ActiveRecord::Base
57
57
  ...
58
58
 
59
59
  def my_custom_clone_method
60
- RailsAdminClone::ModelCloner.new(self).default_clone.tap do |post|
60
+ self.dup.tap do |post|
61
61
  post.status = :draft
62
62
  post.slug = nil
63
63
  post.title = "Copy of #{self.title}"
@@ -124,11 +124,7 @@ module RailsAdminClone
124
124
 
125
125
  # clone has_and_belongs_to_many associtations
126
126
  def clone_habtm(old_object, new_object)
127
- associations = old_object.class.reflect_on_all_associations.select do |a|
128
- a.macro == :has_and_belongs_to_many || (a.macro == :has_many && a.options.keys.include?(:through))
129
- end
130
-
131
- associations.each do |association|
127
+ old_object.class.reflect_on_all_associations.select{|a| a.macro == :has_and_belongs_to_many}.each do |association|
132
128
  method_ids = "#{association.name.to_s.singularize.to_sym}_ids"
133
129
  new_object.send(:"#{method_ids}=", old_object.send(method_ids))
134
130
  end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminClone
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_clone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Dal Ponte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-28 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,29 +16,29 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: '3.2'
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.2.0
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails_admin
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
41
- description: Rails Admin custom action to clone an existing record to new one
40
+ version: '0.4'
41
+ description: Rails Admin custom action to clone records
42
42
  email:
43
43
  - info@andreadalponte.com
44
44
  executables: []
@@ -79,5 +79,5 @@ rubyforge_project:
79
79
  rubygems_version: 2.2.1
80
80
  signing_key:
81
81
  specification_version: 4
82
- summary: Rails Admin plugin to clone existing records
82
+ summary: Rails Admin plugin to clone records
83
83
  test_files: []