Skip to content

Commit

Permalink
Fix bug when run the rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
mashiro committed May 8, 2012
1 parent 4ef395d commit 1f35def
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sakuramochi/predicate_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module PredicateBuilder

included do
unless respond_to? :build
model_class = defined?(ActiveRecord::Model) ? ActiveRecord::Model : ActiveRecord::Base

def self.build(attribute, value)
model_class = defined?(ActiveRecord::Model) ? ActiveRecord::Model : ActiveRecord::Base

case value
when ActiveRecord::Relation
value = value.select(value.klass.arel_table[value.klass.primary_key]) if value.select_values.empty?
Expand Down

0 comments on commit 1f35def

Please sign in to comment.