Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'pricing_section_dimensions' into pricing_door_line_section

  • Loading branch information...
commit 6576170aaf339e770ca539ba9f4c51a49d5e7068 2 parents 6503a48 + 18861de
@josyan authored
View
3  app/models/door_line_section.rb
@@ -17,6 +17,9 @@ def price
# door glass
p += door_glass.price if door_glass
+ # section dimension
+ p += door_section_dimension.price
+
p
end
View
2  app/models/door_section_dimension.rb
@@ -1,3 +1,5 @@
class DoorSectionDimension < ActiveRecord::Base
+ include Priceable
+
belongs_to :door_section
end
View
4 app/views/door_section_dimensions/_form.html.erb
@@ -5,4 +5,8 @@
<td align="right"><%= trn_geth('LABEL_SIZE') %><%= trn_geth('LABEL_SEMICOLON') %></td>
<td><%= text_field 'door_section_dimension', 'value', :size => 30 %></td>
</tr>
+ <tr valign="top">
+ <td align="right"><%= trn_geth('LABEL_PRICE') %><%= trn_geth('LABEL_SEMICOLON') %></td>
+ <td><%= text_field 'door_section_dimension', 'price', :size => 30 %></td>
+ </tr>
</table>
View
9 db/migrate/20120229023057_add_price_to_door_section_dimensions.rb
@@ -0,0 +1,9 @@
+class AddPriceToDoorSectionDimensions < ActiveRecord::Migration
+ def self.up
+ add_column :door_section_dimensions, :price, :float, :default => 0.0
+ end
+
+ def self.down
+ remove_column :door_section_dimensions, :price
+ end
+end
View
3  db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120229021033) do
+ActiveRecord::Schema.define(:version => 20120229023057) do
create_table "companies", :force => true do |t|
t.string "name", :limit => 100, :default => "", :null => false
@@ -175,6 +175,7 @@
t.float "value"
t.datetime "created_at"
t.datetime "updated_at"
+ t.float "price", :default => 0.0
end
create_table "door_sections", :force => true do |t|
Please sign in to comment.
Something went wrong with that request. Please try again.