Frank,

It's probably a combination of two things that I need to investigate. First, 
1.9 is much more picky about resolving namespaces (try ::Boolean?). Second, I 
probably need to make sure that the casting.rb file is eagerly loaded and not 
lazily.

Sean Cribbs <s...@basho.com>
Developer Advocate
Basho Technologies, Inc.
http://basho.com/

On Jun 2, 2010, at 5:59 AM, francisco treacy wrote:

> My User model has some properties
> 
>  property :name, String
>  property :email, String, :presence => true
>  property :items, Array, :default => []
>  (...)
> 
> Now when I want to use a Boolean:
>  property :admin, Boolean
> 
> I get the following:
> 
> ruby-1.9.1-p378 > user = User.find('t...@gmail.com')
> NameError: uninitialized constant User::Boolean
>       from /Users/ftreacy/Documents/work/projects/ws/app/models/user.rb:30:in
> `<class:User>'
>       from /Users/ftreacy/Documents/work/projects/ws/app/models/user.rb:20:in
> `<top (required)>'
> 
> Why isn't Ripple's Boolean not being found? What am I missing?
> 
> Francisco
> 
> ps: my current workaround: copy/paste the Module into user.rb - this works
> 
> module Boolean
>  def self.ripple_cast(value)
>    case value
>    when NilClass
>      nil
>    when Numeric
>      !value.zero?
>    when TrueClass, FalseClass
>      value
>    when /^\s*t/i
>      true
>    when /^\s*f/i
>      false
>    else
>      value.present?
>    end
>  end
> end
> 
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to