#918 ✓invalid
Bryan Larsen

1.3 regression: part loading without valid context

Reported by Bryan Larsen | February 16th, 2011 @ 02:55 AM | in Hobo 1.3 (Rails 3)

We've got a view without a context, it's just a controller method & a view routed manually. It renders fine, but when we try to render a part inside of it via ajax, it crashes

(rdb:2) list
[160, 169] in /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/template_environment.rb
   160        res
   161      end
   162  
   163  
   164      def refresh_part(encoded_context, session, dom_id)
=> 165        context = Dryml::PartContext.for_refresh(encoded_context, @this, session)
   166  
   167        with_part_context(context) do
   168          send("#{context.part_name}_part", *context.locals)
   169        end
(rdb:2) irb

ruby-1.9.2-p136 :001 > pp  Dryml::PartContext.for_refresh(encoded_context, @this, session)
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/part_context.rb:110:in `parse_this_id'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/part_context.rb:88:in `unmarshal'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/part_context.rb:47:in `block in for_refresh'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/part_context.rb:53:in `initialize'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/part_context.rb:46:in `new'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/part_context.rb:46:in `for_refresh'
    from (irb):1:in `refresh_part'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:275:in `one_cmd'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `each'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `block in process_commands'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `catch'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `process_commands'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:173:in `at_line'
    from (eval):5:in `block in at_line'
    from <internal:prelude>:10:in `synchronize'
... 76 levels...
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/rack/logger.rb:13:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/runtime.rb:17:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/lock.rb:11:in `block in call'
    from <internal:prelude>:10:in `synchronize'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/lock.rb:11:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/static.rb:30:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:168:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/rack/debugger.rb:21:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/rack/log_tailer.rb:14:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/content_length.rb:13:in `call'
    from /home/blarsen/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/handler/webrick.rb:52:in `service'
    from /home/blarsen/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
    from /home/blarsen/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
    from /home/blarsen/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'ruby-1.9.2-p136 :002 > 
ruby-1.9.2-p136 :003 >   nil
 => nil 
ruby-1.9.2-p136 :004 > 
/home/blarsen/.rvm/gems/ruby-1.9.2-p136/bundler/gems/hobo-17639ff95d31/dryml/lib/dryml/template_environment.rb:165
context = Dryml::PartContext.for_refresh(encoded_context, @this, session)
(rdb:2)

We can eliminate the problem by doing this:

<do with="&nil">
 <div part="searchresults">
    ...
 </div>
</do>

This did work without the above hack on the Hobo 1.0 version of the app.

Comments and changes to this ticket

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

Referenced by

Pages