Skip to content

Commit

Permalink
hobo_index_for was not working with has_many associations. [#480 stat…
Browse files Browse the repository at this point in the history
…e:resolved]
  • Loading branch information
bryanlarsen committed Oct 20, 2009
1 parent 7ee2c6e commit e7f9dea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
desc "Run tests and doctests for all components."
task :test_all do |t|
puts "There are system tests in http://github.com/tablatom/agility/tree/master"
puts "and http://github.com/bryanlarsen/hobo-test"
system("cd hobofields ; rake test:doctest") &&
system("cd hobofields ; rake test:unit") &&
system("cd hobosupport ; rake test:doctest") &&
Expand Down
10 changes: 9 additions & 1 deletion hobo/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
=== Hobo 0.8.10 ==
=== Hobo Edge ===

Major bug fixes:

- [Bug
480](https://hobo.lighthouseapp.com/projects/8324/tickets/480-find_owner_and_association-method-for-has_many-associations)
Owner actions now work with has_many associations

=== Hobo 0.8.10 ===

This is a brown paper bag release. The fix for Bug 473 was not
properly tested. Thanks Iain Beeston for quickly sending us a patch.
Expand Down
6 changes: 3 additions & 3 deletions hobo/lib/hobo/model_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ def find_or_paginate(finder, options)

def find_owner_and_association(owner_association)
refl = model.reflections[owner_association]
klass = refl.klass
id = params["#{owner_association}_id"]
owner = klass.find(id)
owner_name = refl.macro == :has_many ? owner_association.to_s.singularize : owner_association
id = params["#{owner_name}_id"]
owner = refl.klass.find(id)
instance_variable_set("@#{owner_association}", owner)
[owner, owner.send(model.reverse_reflection(owner_association).name)]
end
Expand Down

0 comments on commit e7f9dea

Please sign in to comment.