Sha256: e13ab5ece58c3d0130b28df2508f8ada6eddf96606da8a99f6968b7a5266462b

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

Find some way to do 

  has_value :something, :klass => Decimal

  * must handle BigDecimal not being around


- 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 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valuable-0.9.1 todo.txt
valuable-0.9.0 todo.txt