Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/nested_has_many_through/association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def construct_has_many_or_belongs_to_attributes(reflection, association_class, t
# Add type_condition, if applicable
conditions += " AND #{association_class.send(:type_condition).to_sql}" if association_class.finder_needs_type_condition?
# Add custom conditions
conditions += " AND (#{association_class.send(:sanitize_sql, reflection.options[:conditions])})" if reflection.options[:conditions]
conditions += " AND (#{interpolate_and_sanitize_sql(reflection.options[:conditions], nil, association_class)})" if reflection.options[:conditions]

if reflection.macro == :belongs_to
if reflection.options[:polymorphic]
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_app/app/models/author.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Author < User
has_many :posts
has_many :posts, :conditions => proc{ "1=1" }
has_many :sources
has_many :categories, :through => :posts
has_many :similar_posts, :through => :categories, :source => :posts
Expand Down