Giter VIP home page Giter VIP logo

Comments (6)

nviennot avatar nviennot commented on June 3, 2024

Can't reproduce in my REPL:

~/brainy (development) > class Model
~/brainy (development) *   include NoBrainer::Document
~/brainy (development) * end  
=> class #<Class:0x00000005cf47c0>::Model < Object {
            :id => :object,
    :created_at => :object,
    :updated_at => :object
}
~/brainy (development) > Model.fields
=> {
            :id => {
        :default => #<Proc:0x00000005b25c28@/home/pafy/nobrainer/lib/no_brainer/document/id.rb:9 (lambda)>
    },
    :created_at => {},
    :updated_at => {}
}

from nobrainer.

ajselvig avatar ajselvig commented on June 3, 2024

Very strange. I just reproduced with a very simple example:

require 'nobrainer'

class MyModel
    include NoBrainer::Document

end

MyModel.fields.each_key do |name|
    puts "Field #{name}: #{MyModel.fields[name]}"
end

Produces:

Field id: {:default=>#<Proc:0x007ff17598a698@/Users/andy/.rvm/gems/ruby-2.0.0-p247/bundler/gems/nobrainer-113d37cea1f6/lib/no_brainer/document/id.rb:9 (lambda)>}

from nobrainer.

nviennot avatar nviennot commented on June 3, 2024

I see, I have the same issue if NoBrainer.configure { } is never called.

from nobrainer.

ajselvig avatar ajselvig commented on June 3, 2024

It must be something more than that. I get the same results with:

class MyModel
    include NoBrainer::Document
end

NoBrainer.configure do |config|
end

MyModel.fields.each_key do |name|
    puts "Field #{name}: #{MyModel.fields[name]}"
end

from nobrainer.

nviennot avatar nviennot commented on June 3, 2024

configure before declaring the class

from nobrainer.

ajselvig avatar ajselvig commented on June 3, 2024

Gotcha. Thanks.

from nobrainer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.