nested_has_many_through 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,7 +58,7 @@ module NestedHasManyThrough
58
58
  # Any subsequent joins / filters on owner attributes will act on the through association,
59
59
  # so that's what we return for the conditions/keys of the overall association.
60
60
  conditions = through_attrs[:conditions]
61
- conditions += " AND #{interpolate_sql(reflection.klass.send(:sanitize_sql, reflection.options[:conditions]))}" if reflection.options[:conditions]
61
+ conditions += " AND #{reflection.klass.send(:sanitize_sql, reflection.options[:conditions])}" if reflection.options[:conditions]
62
62
 
63
63
  {
64
64
  :joins => "%s INNER JOIN %s ON ( %s = %s.%s %s) %s %s" % [
@@ -98,7 +98,7 @@ module NestedHasManyThrough
98
98
  # Add type_condition, if applicable
99
99
  conditions += " AND #{association_class.send(:type_condition).to_sql}" if association_class.finder_needs_type_condition?
100
100
  # Add custom conditions
101
- conditions += " AND (#{interpolate_sql(association_class.send(:sanitize_sql, reflection.options[:conditions]))})" if reflection.options[:conditions]
101
+ conditions += " AND (#{association_class.send(:sanitize_sql, reflection.options[:conditions])})" if reflection.options[:conditions]
102
102
 
103
103
  if reflection.macro == :belongs_to
104
104
  if reflection.options[:polymorphic]
@@ -1,3 +1,3 @@
1
1
  module NestedHasManyThrough
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  class User < ActiveRecord::Base
2
- has_many :comments
3
- has_many :commented_posts, :through => :comments, :source => :post, :uniq => true
2
+ has_many :comments, :conditions => {:id => 0..1000}
3
+ has_many :commented_posts, :through => :comments, :source => :post, :uniq => true, :conditions => '1=1'
4
4
  has_many :commented_authors, :through => :commented_posts, :source => :author, :uniq => true
5
5
  has_many :posts_of_interest, :through => :commented_authors, :source => :posts_of_similar_authors, :uniq => true
6
6
  has_many :categories_of_interest, :through => :posts_of_interest, :source => :category, :uniq => true
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nested_has_many_through
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ian White
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-14 00:00:00 +03:00
13
+ date: 2011-04-16 00:00:00 +03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency