#202 new
Dmytrii Nagirniak

error on assignment [2011, 12, 7] to born, ex: Unknown type Date

Reported by Dmytrii Nagirniak | December 7th, 2011 @ 02:25 AM


It looks like neo4j gem doesn't understand how to set the Date/Time that comes from the Rails request.

I've created the scaffolding for a brand new Rails 3.1 app:

bundle exec rails generate scaffold User email:string name:string born:date

But when I start the server and try to create a new User I get the error (as in the subject).

It seems that neo4j can't understand that [2011, 12, 7] is Date/DateTime.

Comments and changes to this ticket

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 09:00 AM

    • Assigned user set to “Andreas Ronge”

    Is it the scaffolding or is it something else that is broken ?
    I'm using a lot of date properties in my projects.

      property :psd, :type => :date

    In the view:

      <%= f.date_select :psd %>
  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 09:37 AM

    It's just a brand new rails application with the generated neo4j scaffolding that has a Date.

    What is broken is the mass assignment I suppose.

    But I am not sure how it can work for you.

    What can I do to help you to repro this?

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 10:03 AM

    A failing RSpec would help a lot

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:35 AM

    Could you please help me pointing to the passing spec (the conversion from [year, month, day] to Date) so that I can get started?

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 10:47 AM

    Hmm there is a similar (?) specs for this in specs/rails/property_specs:
    Not sure what the request params looks like in your case.

    context "update_attributes" do
        it "with Time" do
          params = {"time(1i)"=>"2006", "time(2i)"=>"1", "time(3i)"=>"5", "time(4i)"=>"02", "time(5i)"=>"03"}
          subject.time.class.should == Time
          subject.time.year.should == 2006
          subject.time.month.should == 1
          subject.time.day.should == 5
          #subject.time.hour.should == 2 # TODO it is stored as UTC time !!!
          #subject.time.min.should == 3
  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:58 AM

    I see. But that's exactly what I have in the request. Not sure what is going on. Can you try to generate the default scaffolding with Date property to see if that happens to you (Rails 3.1)?

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:59 AM

    Here is the exact call stack if it helps:

    neo4j-1.3.0 (java) lib/neo4j/rails/attributes.rb:119:in `execute_callstack_for_multiparameter_attributes'
    org/jruby/RubyHash.java:1175:in `each'
    neo4j-1.3.0 (java) lib/neo4j/rails/attributes.rb:88:in `execute_callstack_for_multiparameter_attributes'
    neo4j-1.3.0 (java) lib/neo4j/rails/attributes.rb:81:in `assign_multiparameter_attributes'
    neo4j-1.3.0 (java) lib/neo4j/rails/attributes.rb:70:in `attributes='
    neo4j-1.3.0 (java) lib/neo4j/rails/model.rb:54:in `initialize'
    neo4j-1.3.0 (java) lib/neo4j/rails/callbacks.rb:47:in `initialize_with_callbacks'
    activesupport (3.1.3) lib/active_support/callbacks.rb:405:in `_run_initialize_callbacks'
    neo4j-1.3.0 (java) lib/neo4j/rails/callbacks.rb:47:in `initialize_with_callbacks'
    app/controllers/users_controller.rb:43:in `create'
    org/jruby/RubyBasicObject.java:1688:in `__send__'
    org/jruby/RubyKernel.java:2114:in `send'
    actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
    actionpack (3.1.3) lib/abstract_controller/base.rb:167:in `process_action'
    actionpack (3.1.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
    actionpack (3.1.3) lib/abstract_controller/callbacks.rb:18:in `process_action'
    activesupport (3.1.3) lib/active_support/callbacks.rb:419:in `_run__434435962__process_action__1623385099__callbacks'
    org/jruby/RubyBasicObject.java:1688:in `__send__'
    org/jruby/RubyKernel.java:2114:in `send'
    activesupport (3.1.3) lib/active_support/callbacks.rb:401:in `_run_process_action_callbacks'
    org/jruby/RubyBasicObject.java:1694:in `__send__'
    org/jruby/RubyKernel.java:2118:in `send'
    activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
    actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
    actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
    actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
    activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
    activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
    actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
    actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
    actionpack (3.1.3) lib/abstract_controller/base.rb:121:in `process'
    actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in `process'
    actionpack (3.1.3) lib/action_controller/metal.rb:193:in `dispatch'
    actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
    actionpack (3.1.3) lib/action_controller/metal.rb:236:in `action'
    org/jruby/RubyProc.java:258:in `call'
    actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
    actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:29:in `call'
    rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `call'
    rack-mount (0.8.3) lib/rack/mount/code_generation.rb:114:in `recognize'
    rack-mount (0.8.3) lib/rack/mount/code_generation.rb:80:in `optimized_each'
    rack-mount (0.8.3) lib/rack/mount/code_generation.rb:113:in `recognize'
    rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
    actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:532:in `call'
    neo4j-1.3.0 (java) lib/neo4j/identity_map.rb:135:in `call'
    neo4j-1.3.0 (java) lib/neo4j/rails/rack_middleware.rb:11:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
    rack (1.3.5) lib/rack/etag.rb:23:in `call'
    rack (1.3.5) lib/rack/conditionalget.rb:35:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247:in `call'
    rack (1.3.5) lib/rack/session/abstract/id.rb:195:in `context'
    rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/cookies.rb:331:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:in `call'
    activesupport (3.1.3) lib/active_support/callbacks.rb:407:in `_run_call_callbacks'
    org/jruby/RubyBasicObject.java:1688:in `__send__'
    org/jruby/RubyKernel.java:2114:in `send'
    activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
    actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/reloader.rb:68:in `call'
    rack (1.3.5) lib/rack/sendfile.rb:101:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
    railties (3.1.3) lib/rails/rack/logger.rb:13:in `call'
    rack (1.3.5) lib/rack/methodoverride.rb:24:in `call'
    rack (1.3.5) lib/rack/runtime.rb:17:in `call'
    activesupport (3.1.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
    rack (1.3.5) lib/rack/lock.rb:15:in `call'
    actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in `call'
    railties (3.1.3) lib/rails/engine.rb:456:in `call'
    rack (1.3.5) lib/rack/content_length.rb:14:in `call'
    railties (3.1.3) lib/rails/rack/log_tailer.rb:14:in `call'
    rack (1.3.5) lib/rack/handler/webrick.rb:59:in `service'
  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 11:16 AM

    I found the reason

    If you change from

     property :born, :type => :Date


     property :born, :type => :date

    It will work. It is a bug.

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:13 PM

    No, the property is declared as Date:

    property :born, :type => Date

    I am not sure where you got :Date from.

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 10:17 PM

    I think it should work with both Date and :date.
    But for some reason it does not work with Date -> bug

  • Dmytrii Nagirniak

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 ยป

Neo4j.rb is a graph database framework for JRuby.

It provides:

* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails

People watching this ticket