status_quo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/status_quo/status_quo.rb +26 -2
- data/lib/status_quo/version.rb +1 -1
- metadata +3 -3
@@ -23,11 +23,35 @@ module StatusQuo
|
|
23
23
|
self.status == '#{status}'
|
24
24
|
end
|
25
25
|
def #{status}!
|
26
|
-
(status = '#{status}') and save
|
26
|
+
(self.status = '#{status}') and save
|
27
27
|
end
|
28
28
|
)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
ActiveRecord::Base.send(:include, StatusQuo) if defined?(ActiveRecord)
|
33
|
+
ActiveRecord::Base.send(:include, StatusQuo) if defined?(ActiveRecord)
|
34
|
+
|
35
|
+
# IDEAS
|
36
|
+
# def self.status_validations &block
|
37
|
+
# validate :status_validations
|
38
|
+
# define_method(:status_validations) do
|
39
|
+
# block.call
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
# status_validations do |from, to|
|
43
|
+
# # You can cancel anytime!
|
44
|
+
# return if to == 'cancelled'
|
45
|
+
# case [from, to]
|
46
|
+
# when [:started, :checkout]
|
47
|
+
# errors.add :status, 'Endereço não especificado' unless address
|
48
|
+
# errors.add :status, 'Você precisa comprar ao menos um produto.' if total.to_f <= 0.0
|
49
|
+
# when [:checkout, :payment]
|
50
|
+
# when [:payment, :finished]
|
51
|
+
# errors.add :status, 'Pagamento não especificado' unless payment_method
|
52
|
+
# errors.add :status, 'Cartão não especificado' if payment_method == 'Cartão de crédito' and ! card_id
|
53
|
+
# errors.add :status, 'Cartão não especificado' if payment_method == 'Compra com 1-click' and ! card_id
|
54
|
+
# else
|
55
|
+
# errors.add :status, 'Mudança de status inválida'
|
56
|
+
# end
|
57
|
+
# end
|
data/lib/status_quo/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: status_quo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Juan Maiz
|