Permalink
Browse files

Fix problem where acts_as_network fails for multi-word models

  • Loading branch information...
1 parent 358fc0c commit c7fcb8aacb8b41e37cbd5b7e54fe8816c67af2fa @sjlombardo committed Jul 19, 2008
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/zetetic/acts/network.rb
View
4 lib/zetetic/acts/network.rb
@@ -246,14 +246,14 @@ def acts_as_network(relationship, options = {})
has_many "#{through_sym}_out".to_sym, :class_name => through_class,
:foreign_key => configuration[:foreign_key]
has_many "#{relationship}_out".to_sym, :through => "#{through_sym}_out".to_sym,
- :source => "#{name.downcase}_target", :foreign_key => configuration[:foreign_key],
+ :source => "#{name.tableize.singularize}_target", :foreign_key => configuration[:foreign_key],
:conditions => configuration[:conditions]
# a node has many inbound relationships
has_many "#{through_sym}_in".to_sym, :class_name => through_class,
:foreign_key => configuration[:association_foreign_key]
has_many "#{relationship}_in".to_sym, :through => "#{through_sym}_in".to_sym,
- :source => name.downcase, :foreign_key => configuration[:association_foreign_key],
+ :source => name.tableize.singularize, :foreign_key => configuration[:association_foreign_key],
:conditions => configuration[:conditions]
# when using a join model, define a method providing a unioned view of all the join

0 comments on commit c7fcb8a

Please sign in to comment.