#1345 ✓not-applicable
Petr Vostrel

ParanoidDateTime and ParanoidBoolean fail in 1.0.0

Reported by Petr Vostrel | June 29th, 2010 @ 11:50 AM

Hey guys,

ParanoidDateTime and ParanoidBoolean types stopped working for me after I upgraded from 0.10.2 to 1.0.0. I'm getting:

/Library/Ruby/Gems/1.8/gems/dm-core-1.0.0/lib/dm-core/model.rb:734:in `const_missing': uninitialized constant Page::ParanoidDateTime (NameError)
    from ./app.rb:130

My app's Page model

class Page
  include DataMapper::Resource
  ...
  property     :deleted_at,   ParanoidDateTime
  property     :deleted,      ParanoidBoolean, :default=> false
  ...
end

I've tried almost everything now, I'm stuck and need your advice. Do I, in version 1.0, need to somehow specificaly include the paranoid functionality into my model? Or is the syntax changed?

My OSX Leopard box:

ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
datamapper (1.0.0, 0.10.2, 0.9.11)
dm-core (1.0.0, 0.10.2, 0.9.11)
dm-mysql-adapter (1.0.0)

Comments and changes to this ticket

  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) June 29th, 2010 @ 01:09 PM

    • State changed from “new” to “unconfirmed”

    Hey Petr, Paranoid types come with dm-types gem. Do you have it installed?

  • Petr Vostrel

    Petr Vostrel June 29th, 2010 @ 01:37 PM

    Hi Piotr,

    Yes I have dm-types installed. All my dm- gems:

    dm-aggregates (1.0.0, 0.10.2, 0.9.11)
    dm-cli (0.10.2, 0.9.11)
    dm-constraints (1.0.0, 0.10.2)
    dm-core (1.0.0, 0.10.2, 0.9.11)
    dm-do-adapter (1.0.0)
    dm-is-tree (0.10.2, 0.9.11)
    dm-is-versioned (1.0.0, 0.10.2)
    dm-migrations (1.0.0, 0.10.2, 0.9.11)
    dm-mysql-adapter (1.0.0)
    dm-observer (0.10.2, 0.9.11)
    dm-paperclip (2.1.4)
    dm-serializer (1.0.0, 0.10.2, 0.9.11)
    dm-sweatshop (0.10.2, 0.9.11)
    dm-timestamps (1.0.0, 0.10.2, 0.9.11)
    dm-transactions (1.0.0)
    dm-types (1.0.0, 0.10.2, 0.9.11)
    dm-validations (1.0.0, 0.10.2, 0.9.11)
    
  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) June 30th, 2010 @ 04:17 AM

    Hmm that's weird. Can you try with Ruby 1.8.7 maybe? We're kinda dropping support for 1.8.6 soon

  • Petr Vostrel

    Petr Vostrel June 30th, 2010 @ 10:02 AM

    Weird, indeed. No luck so far :/ Anyway, thanks for pointing me somewhere!

    I upgraded to Ruby 1.8.7. Made a fresh side-install of ruby-enterprise-1.8.7:

    $ ./ruby-enterprise-1.8.7/installer
    $ ruby -v
    ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin9.8.0], MBARI 0x8770, Ruby Enterprise Edition 2010.02
    

    and obviously also a fresh side-install of all gems I need:

    $ gem install sinatra datamapper dm-mysql-adapter dm-is-versioned dm-paperclip RedCloth
    $ gem list
    actionmailer (2.3.8, 2.3.2)
    actionpack (2.3.8, 2.3.2)
    activerecord (2.3.8, 2.3.2)
    activeresource (2.3.8, 2.3.2)
    activesupport (2.3.8, 2.3.2)
    addressable (2.1.0, 2.0.0)
    cheat (1.2.1)
    cucumber (0.3.91)
    data_objects (0.10.2)
    datamapper (1.0.0)
    dm-aggregates (1.0.0)
    dm-constraints (1.0.0)
    dm-core (1.0.0)
    dm-do-adapter (1.0.0)
    dm-is-versioned (1.0.0)
    dm-migrations (1.0.0)
    dm-mysql-adapter (1.0.0)
    dm-paperclip (2.4.1)
    dm-serializer (1.0.0)
    dm-timestamps (1.0.0)
    dm-transactions (1.0.0)
    dm-types (1.0.0)
    dm-validations (1.0.0)
    do_mysql (0.10.2)
    extlib (0.9.15)
    fastercsv (1.5.3)
    fastthread (1.0.7)
    haml (2.0.8)
    json_pure (1.4.3)
    mislav-will_paginate (2.3.8)
    mocha (0.9.5)
    mysql (2.8.1)
    nifty-generators (0.2.3)
    passenger (2.2.15)
    rack (1.2.1, 1.1.0)
    rails (2.3.8, 2.3.2)
    rake (0.8.7)
    RedCloth (4.2.3)
    sinatra (1.0)
    sqlite3-ruby (1.3.0)
    stringex (1.1.0)
    syntax (1.0.0)
    test-spec (0.10.0)
    tidy (1.1.2)
    treetop (1.3.0)
    uuidtools (2.1.1)
    ZenTest (4.0.0)
    

    and still the same error on the same place...

    /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/model.rb:734:in `const_missing': uninitialized constant Page::ParanoidDateTime (NameError)
    
  • Ripta Pasay

    Ripta Pasay June 30th, 2010 @ 06:14 PM

    I've seen that const_missing error happen when dm-types isn't loaded.

    Can you check to make sure that not only is the dm-types gem loaded, but also required? Adding require 'dm-types' after require 'dm-core' should do the trick.

  • Petr Vostrel

    Petr Vostrel July 1st, 2010 @ 04:10 AM

    @Ripta: That was it! After I required dm-types it's all working again in both Ruby 1.8.6 and 1.8.7.

    Awesome :) Thank you all for helping me! Cheers.

  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) July 1st, 2010 @ 04:15 AM

    • State changed from “unconfirmed” to “not-applicable”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages