#565 ✓resolved
Betelgeuse

rake hobo:generate_taglibs fails after upgrade to 0.9.102

Reported by Betelgeuse | December 2nd, 2009 @ 05:37 PM | in Beyond Hobo 1.0

After upgrading hobo to 0.9.102 I am unavailable to run rake hobo:generate_taglibs.
I don't have time to look into what specifically triggers this now but maybe it's evident to you immediately.
If not then just ask for more information and I can look into locating the issue more specifically.

betelgeuse@mac $ rake --trace hobo:generate_taglibs
** Invoke hobo:generate_taglibs (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute hobo:generate_taglibs
rake aborted!
undefined method `name' for nil:NilClass
/Library/Ruby/Gems/1.8/gems/hobosupport-0.9.102/lib/hobo_support.rb:29:in `safe_constantize'
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/view_hints.rb:39
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/view_hints.rb:21:in `instance_exec'
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/view_hints.rb:21:in `children'
/Users/betelgeuse/project/app/viewhints/model_hints.rb:2
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in `load_file'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:379:in `load_file'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:259:in `require_or_load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
(eval):1:in `safe_constantize'
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/model.rb:370:in `view_hints'
/Library/Ruby/Gems/1.8/gems/hobosupport-0.9.102/lib/hobo_support/enumerable.rb:46:in `send'
/Library/Ruby/Gems/1.8/gems/hobosupport-0.9.102/lib/hobo_support/enumerable.rb:46:in `method_missing'
/Library/Ruby/Gems/1.8/gems/hobosupport-0.9.102/lib/hobo_support/enumerable.rb:46:in `map'
/Library/Ruby/Gems/1.8/gems/hobosupport-0.9.102/lib/hobo_support/enumerable.rb:46:in `send'
/Library/Ruby/Gems/1.8/gems/hobosupport-0.9.102/lib/hobo_support/enumerable.rb:46:in `method_missing'
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/dryml/dryml_generator.rb:79:in `run'
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/dryml/dryml_generator.rb:50:in `run'
/Library/Ruby/Gems/1.8/gems/hobo-0.9.102/lib/hobo/tasks/../../../tasks/hobo_tasks.rake:33
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Comments and changes to this ticket

  • Matt Jones

    Matt Jones December 2nd, 2009 @ 06:37 PM

    • Assigned user set to “Matt Jones”
    • State changed from “new” to “investigating”

    From the code, it looks like the changes in d7b63ab8e112f3b60a0f37d7c8a75190845f4639 caused this; can you post the associations to/from the model that's blowing up? Looks like the first association specified via 'children' in app/viewhints/model_hints.rb doesn't have a detectable reverse_reflection.

  • Betelgeuse

    Betelgeuse December 2nd, 2009 @ 07:18 PM

    I think this is the relevant association:

     27   has_many :pivots, :dependent => :destroy
     28   has_many(:foos, :through => :pivots,
     29            :class_name => 'TheNameOfClass', :source => :attribute, :order => 'name')
     30
    

    As the stack trace has name it's probably not liking the :order attribute.

  • Betelgeuse

    Betelgeuse December 2nd, 2009 @ 07:32 PM

    After I simplified this association it choked on an another that is not even listed in viewhints:

    has_one :test_thingy, :class_name => 'Thingy', :dependent => :destroy
    
  • Matt Jones

    Matt Jones December 2nd, 2009 @ 07:32 PM

    It's trickier than that - :order can't cause this problem. The issue is most likely on the other end of the :through from the model that's blowing up. (assuming that :foos is first in the children view_hint)

    Here's a schematic markup of a hm:t association:

    class Foo:
    has_many :pivots
    has_many :bars, :through => :pivots


    class Pivot: belongs_to :foo belongs_to :bar


    class Bar: has_many :pivots has_many :foos, :through => :pivots

    Setting :conditions or :scope on pretty much ANY of these will cause the reverse reflection for :bars to not exist.

    Non-sanitized source (I'm guessing you don't really have a model named Foo) will always help; feel free to contact me off-LH if privacy is an issue.

  • Betelgeuse

    Betelgeuse December 2nd, 2009 @ 07:37 PM

    Yeah this seems to be coming when there's no reverse association or it can't find it. In the latter case I don't have it either as I have no need for it.

  • Betelgeuse

    Betelgeuse December 2nd, 2009 @ 07:50 PM

    Of course in the latter case I do have it or it wouldn't work :)
    Any way if you need info I am around in IRC with the same nick.

  • Matt Jones
  • Matt Jones

    Matt Jones December 3rd, 2009 @ 01:29 AM

    If you get a chance, can you test out the above commit and see if it works?

  • Betelgeuse

    Betelgeuse December 3rd, 2009 @ 08:31 PM

    I copied the following from the commit to an initializer and it at least the generator runs.
    There's some test failures still but they might not be related to this issue. Will report here
    after investigation they could be related to this one.

    module Hobo
      class ViewHints
        setter :children,    [] do |*args|
          # Setting children also gives a default parent using the reverse association
          child_model = model.reflections[args.first].klass
          if child_model.view_hints.parent.nil? and !child_model.view_hints.parent_defined
            parent = model.reverse_reflection(args.first)
            child_model.view_hints.parent(parent.name, :undefined => true) if parent
          end
          args
        end
      end
    end
    
  • Owen
  • Owen

    Owen January 10th, 2010 @ 07:28 PM

    • Milestone set to Beyond Hobo 1.0
  • Betelgeuse

    Betelgeuse January 10th, 2010 @ 07:43 PM

    Changing this to Beyond Hobo 1.0 is weird as this is already fixed.

  • Owen

    Owen January 10th, 2010 @ 08:21 PM

    Thanks. It was not listed as fixed. ;-)

  • Matt Jones

    Matt Jones January 22nd, 2010 @ 05:40 PM

    • State changed from “investigating” to “resolved”

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