forked from mustmodify/valuable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.txt
84 lines (54 loc) · 1.71 KB
/
todo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
- has_value :start_date, :default => {Date.today}
- has_value :price, :default => 50, :extend => MoneyFormatter
class SomeSearchThing < Valuable
has_value :dob
has_value :sign
parser_for( dob ) do |input|
Date.parse(input)
end
end
BEST PRACTICES DOC
When creating a searcher:
class UserSearcher < Valuable
has_value :age
has_value :query
has_value :expertise
has_value :eye_color
def conditions
[ eye_color_conditions, name_conditions, ... ].compact.join(' OR ')
end
end
- Rails 3 support
- Add Valuable#to_yaml and Valuable.from_yaml
- make it easy to include validatable or ActiveRecord::Validations
- make it easy to use has_value from activerecord model.
- add optional :always_klass ?
- for :klass => :integer, 'abc' resolves to 0 ... fix that.
- optionally, values should be on the class rather than the instance, as in:
Config < ValuableClass
has_value :background_color
end
Config.background_color
- 2. Create a 'Valuable::Presenter' base class that filters out rails params, handles nested params, knows 0 is false for checkboxes, works with form_for#checkbox...
class ProductsController < ApplicationController
def reviews
@presenter = ReviewPresenter.new(params)
@product = @presenter.product
@reviews = @presenter.reviews
end
end
which currently raises:
undefined method `action=' for #<ReviewPresenter:0x5e7fa18>
like this:
def initialize(atts = {})
super(atts.except('action', 'controller'))
end
:klass => :decimal
- When is decimal available? Only load then.
- If calling :decimal and it hasn't loaded, error
class Change < Decimal
extend Valuable::whatever or
extend Valuable
...
end
- do a better job with method_missing