Skip to content

Commit

Permalink
removed method_missing for 192
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus committed Feb 4, 2011
1 parent cc13984 commit d0ebeb5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/spree_related_products.rb
Expand Up @@ -15,16 +15,16 @@ def self.relation_types
RelationType.find_all_by_applies_to(self.to_s, :order => :name)
end

def method_missing(method, *args)
relation_type = self.class.relation_types.detect { |rt| rt.name.downcase.gsub(" ", "_").pluralize == method.to_s.downcase }

if relation_type.nil?
super
else
relations.find_all_by_relation_type_id(relation_type.id).map(&:related_to).select {|product| product.deleted_at.nil? && product.available_on <= Time.now()}
end

end
#def method_missing(method, *args)
# relation_type = self.class.relation_types.detect { |rt| rt.name.downcase.gsub(" ", "_").pluralize == method.to_s.downcase }
#
# if relation_type.nil?
# super
# else
# relations.find_all_by_relation_type_id(relation_type.id).map(&:related_to).select {|product| product.deleted_at.nil? && product.available_on <= Time.now()}
# end
#
#end
end

Admin::ProductsController.class_eval do
Expand Down

0 comments on commit d0ebeb5

Please sign in to comment.