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
-
Domizio Demichelis March 10th, 2011 @ 07:49 PM
please, retry this with an edge-new-created app, the fix for #826 might have solved this one too.
-
Domizio Demichelis March 25th, 2011 @ 10:13 PM
- State changed from new to resolved
(from [e744d2a4568f957155e2c6d89dd60352630e7844]) fix for unexistent @this instance variable reference in template_environent [#918 state:resolved] https://github.com/tablatom/hobo/commit/e744d2a4568f957155e2c6d89dd...
-
Domizio Demichelis March 25th, 2011 @ 10:16 PM
- Assigned user set to Domizio Demichelis
There was a reference to an unexistent @this instance variable, that was working only when
this
was nil (obviously). Ideed theDryml::TemplateEnvironment
object does not have any assignation to@this
: theDryml::TemplateEnvironment#this
reader is explicitly defined and returns@_this
.There was also another reference to the ghost variable, although not directly involved in this particular bug.
If the previous version was working it's just for some sort of coincidence. You probably will have to apply the patch for the older versions...
-
Bryan Larsen July 4th, 2011 @ 06:55 PM
- State changed from resolved to open
Domizio:
@this
was actually the right thing here. this refers to the current context, whereas @this refers to the original page context. Your fix causes this bug: http://groups.google.com/group/hobousers/browse_thread/thread/9e760...# and perhaps other AJAX strangeness people have seen.I'm trying this out:
elsif @this && object == @this
. It looks OK at first glance. I'll probably commit it later this afternoon. -
Bryan Larsen July 4th, 2011 @ 08:29 PM
- State changed from open to resolved
(from [cef7f29e8bfc66a3b1ef0cbc2397fe8f9612b96b]) Revert "fix for unexistent @this instance variable reference in template_environent [#918 state:resolved]"
This reverts commit e744d2a4568f957155e2c6d89dd60352630e7844.
https://github.com/tablatom/hobo/commit/cef7f29e8bfc66a3b1ef0cbc239... -
Bryan Larsen July 5th, 2011 @ 02:19 AM
- State changed from resolved to invalid
OK, I can confirm that the original bug report was caused by a crappy workaround for #957.
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.
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
- 918 1.3 regression: part loading without valid context (from [e744d2a4568f957155e2c6d89dd60352630e7844]) fix for...