Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use new_record? rather than id.nil?

  • Loading branch information...
commit cbf20f5b79fd559e0d5c8facacc37104b1a2ce88 1 parent 4831f0a
@alexdowad alexdowad authored radar committed
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
Please sign in to comment.
Something went wrong with that request. Please try again.