when multiple arguments given to children - only first gets special treatment (ie.: link to parent on show-page)
Reported by graf0 (at post) | August 24th, 2011 @ 11:36 AM | in Hobo 1.4
...and NOT showing parent association field on show-page.
It's quite annoying - you can of course preapre page for second child manually - but I think framework should take care of that :)
So I think it's a bug. I use hobo edge. Here is patch for solving this problem:
--- view_hints.rb 2011-08-24 12:25:08.000000000 +0200
+++ view_hints.rb.new 2011-08-24 12:33:51.000000000 +0200
@@ -11,10 +11,12 @@ module Hobo
if @children_args.nil? # value already set
@children ||= []
else # set
- child_model = model.reflect_on_association(@children_args.first).klass
- if child_model.view_hints.parent.nil? and !child_model.view_hints.parent_defined
- parent = model.reverse_reflection(@children_args.first)
- child_model.view_hints.parent(parent.name, :undefined => true) if parent
+ @children_args.each do |child_arg|
+ child_model = model.reflect_on_association(child_arg).klass
+ if child_model.view_hints.parent.nil? and !child_model.view_hints.parent_defined
+ parent = model.reverse_reflection(child_arg)
+ child_model.view_hints.parent(parent.name, :undefined => true) if parent
+ end
end
@children = @children_args
@children_args = nil
I hope it doesn't break anything (don't seems so, but I'm quite new to hobo).
Comments and changes to this ticket
-
Matt Jones September 9th, 2011 @ 07:15 PM
- Assigned user set to Matt Jones
It's slightly more complicated than this, as the second (and subsequent) association in the
children
declaration should be appearing in the aside section of the page. This behavior will probably not change for 1.3.0, though. -
Matt Jones September 14th, 2011 @ 08:47 PM
- Milestone set to Hobo 1.4
- Milestone order changed from 197979 to 0
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 ยป