activerecord-draft_records 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
@@ -21,7 +21,7 @@ module ActiveRecord
21
21
  end
22
22
 
23
23
  # Attempt to create the record, if it fails, save it as a draft
24
- def create_or_draft(attributes = {}, &block)
24
+ def create_or_draft(attributes = {}, options = {}, &block)
25
25
  if attributes.is_a?(Array)
26
26
  attributes.collect { |attr| create_as_draft(attr, &block) }
27
27
  else
@@ -47,10 +47,10 @@ module ActiveRecord
47
47
  end
48
48
 
49
49
  # Save the record and, if it is a draft, attempt to transform it in a normal (non-draft) record.
50
- def save_and_attempt_to_undraft
50
+ def save_and_attempt_to_undraft(options = {})
51
51
  if self.draft?
52
52
  self.draft = false if self.valid?
53
- save(:validate => false)
53
+ save(options.merge(:validate => false))
54
54
  !self.draft
55
55
  else
56
56
  save
@@ -65,8 +65,8 @@ module ActiveRecord
65
65
  end
66
66
 
67
67
  # Attempt to save the record, if any validation fails, save it as a draft.
68
- def save_or_draft
69
- save || save_as_draft
68
+ def save_or_draft(options = {})
69
+ save(options) || save_as_draft
70
70
  end
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-draft_records
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 0.4.0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rodrigo Kochenburger
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-25 00:00:00 -02:00
18
+ date: 2010-11-12 00:00:00 -02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency