Commit 1af7590f0b7eabeae5c3f5903317f9de316eacec
Committed by
Daniela Feitosa
1 parent
2e90d757
Exists in
master
and in
29 other branches
Fix use of production cost in product search
Showing
3 changed files
with
7 additions
and
2 deletions
Show diff stats
app/models/price_detail.rb
... | ... | @@ -4,9 +4,13 @@ class PriceDetail < ActiveRecord::Base |
4 | 4 | validates_presence_of :product_id |
5 | 5 | |
6 | 6 | belongs_to :production_cost |
7 | - validates_presence_of :production_cost_id | |
7 | + validates_presence_of :production_cost | |
8 | 8 | validates_uniqueness_of :production_cost_id, :scope => :product_id |
9 | 9 | |
10 | + def name | |
11 | + production_cost.name | |
12 | + end | |
13 | + | |
10 | 14 | def price |
11 | 15 | self[:price] || 0 |
12 | 16 | end | ... | ... |
app/models/production_cost.rb
app/views/search/_product.rhtml
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | <% if product.price_described? %> |
30 | 30 | <% title = (product.inputs + product.price_details).map{ |i| |
31 | 31 | '<div class="search-product-input-dots-to-price">' + |
32 | - '<div class="search-product-input-name">' + i.product_category.name + '</div>' + | |
32 | + '<div class="search-product-input-name">' + i.name + '</div>' + | |
33 | 33 | price_span(i.price, :class => 'search-product-input-price') + |
34 | 34 | '</div>' }.join('') %> |
35 | 35 | <%= link_to_function _("Open Price"), '', :title => title, :class => "search-product-price-details" %> | ... | ... |