This is my code,
user controller 42:
@user =
User.with_clients.with_projects.find(doorkeeper_token.resource_owner_id)
active support code that error out.
def define_callbacks(kind, object) #:nodoc:
name = _callback_runner_name(kind)
unless object.respond_to?(name, true)
str = object.send("#{kind}_callbacks").compile
class_eval <<-RUBY_EVAL, __FILE, LINE + 1
def #{name}() #{str} end
protected :#{name}
RUBY_EVAL
end
name
end
So some how active support try to eval a “def () value = nil” here.
Which
mean #{name} is empty?
I thought the code …
object.respond_to?(name, true) is intended to prevent cases where name
is
empty or nil. But when the #{name} used in the class_eval came from
_callback_runner_name(kind) and has nothing to do with object.name
So I am not sure if the code is checking the wrong thing when checking
object.respond_to?(name, true)
And I dont know at what instance would _callback_runner_name(kind)
returns
empty for me. Any idea what these code was intended to do. In the case
that
_callback_runner_name(kind) is returning empty, I am not sure how this
will be my code causing the issue at the moment.
[363, 372] in
/Users/~/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/activesupport-4.0.0/lib/active_support/callbacks.rb
363 # This method defines callback chain method for the given
kind
364 # if it was not yet defined.
365 # This generated method plays caching role.
366 def __define_callbacks(kind, object) #:nodoc:
367 debugger
=> 368 name = __callback_runner_name(kind)
369 unless object.respond_to?(name, true)
370 str = object.send("_#{kind}_callbacks").compile
371 class_eval <<-RUBY_EVAL, FILE, LINE + 1
372 def #{name}() #{str} end
/Users/~/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:368
name = __callback_runner_name(kind)
(rdb:1) name = __callback_runner_name(kind)
“_run__1313977386__find__callbacks”
(rdb:1) kind
:find
(rdb:1) str
nil
(rdb:1) object.send("_#{kind}_callbacks").compile
“value = nil\nhalted = false\nvalue = !halted && (!block_given? ||
yield)\nvalue”
(rdb:1) object
#<ClientMembership id: 1, client_id: 1, user_id: 1, is_client_admin:
true,
created_at: “2013-06-18 20:23:13”, updated_at: “2013-06-18 20:23:13”>
(rdb:1) object.name
“[email protected]”