Skip to content

Commit

Permalink
fix record delete
Browse files Browse the repository at this point in the history
  • Loading branch information
fuCtor committed Dec 5, 2012
1 parent 05f52a2 commit 1f98a8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ext_sti/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def relation #:nodoc:

if finder_needs_type_condition?
type = params[:type] || self.to_s
type_id = params[:id] ||= association.klass.where(params[:field_name] => type).first
type_id = params[:id] || 0
type_id = (params[:id] = association.klass.where(params[:field_name] => type).first) if type_id == 0

@relation.where(association.foreign_key.to_sym => type_id )
else
Expand Down

0 comments on commit 1f98a8c

Please sign in to comment.