Permalink
Browse files

Use new_record? rather than id.nil?

  • Loading branch information...
1 parent 4831f0a commit cbf20f5b79fd559e0d5c8facacc37104b1a2ce88 @alexdowad alexdowad committed with radar May 15, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/app/models/spree/product.rb
View
2 core/app/models/spree/product.rb
@@ -59,7 +59,7 @@ class Product < ActiveRecord::Base
accepts_nested_attributes_for :variants, :allow_destroy => true
def variant_images
- return [] if self.id.nil? # newly created record?
+ return [] if self.new_record? # newly created record?
Image.find_by_sql("SELECT #{Asset.quoted_table_name}.* FROM #{Asset.quoted_table_name} LEFT JOIN #{Variant.quoted_table_name} ON (#{Variant.quoted_table_name}.id = #{Asset.quoted_table_name}.viewable_id) WHERE (#{Variant.quoted_table_name}.product_id = #{self.id}) ORDER BY #{Asset.quoted_table_name}.position")
end

0 comments on commit cbf20f5

Please sign in to comment.