Skip to content

Commit

Permalink
reformatting for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
kronn committed Oct 4, 2010
1 parent a638f48 commit 862aa29
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/has_many_polymorphs/association.rb
Expand Up @@ -144,10 +144,15 @@ def custom_conditions #:nodoc:

# construct attributes for join for a particular record
def construct_join_attributes(record) #:nodoc:
{@reflection.options[:polymorphic_key] => record.id,
{
@reflection.options[:polymorphic_key] => record.id,
@reflection.options[:polymorphic_type_key] => "#{record.class.base_class}",
@reflection.options[:foreign_key] => @owner.id}.merge(@reflection.options[:foreign_type_key] ?
{@reflection.options[:foreign_type_key] => "#{@owner.class.base_class}"} : {}) # for double-sided relationships
@reflection.options[:foreign_key] => @owner.id
}.merge(
@reflection.options[:foreign_type_key] ?
{ @reflection.options[:foreign_type_key] => "#{@owner.class.base_class}" } :
{}
) # for double-sided relationships
end

def build(attrs = nil) #:nodoc:
Expand Down

0 comments on commit 862aa29

Please sign in to comment.