moved payment options configuration out of settings.yml and into a model

This commit is contained in:
Jesse Grant
2013-01-14 16:40:43 -05:00
parent 857ad44956
commit 451bca08e3
7 changed files with 120 additions and 26 deletions

View File

@@ -0,0 +1,15 @@
class CreatePaymentOptions < ActiveRecord::Migration
def change
create_table :payment_options do |t|
t.decimal :amount
t.string :amount_display
t.text :description
t.string :shipping_desc
t.string :delivery_desc
t.integer :limit
t.integer :purchased_count
t.timestamps
end
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121004072706) do
ActiveRecord::Schema.define(:version => 20130106183354) do
create_table "orders", :id => false, :force => true do |t|
t.string "token"
@@ -36,6 +36,18 @@ ActiveRecord::Schema.define(:version => 20121004072706) do
t.datetime "updated_at", :null => false
end
create_table "payment_options", :force => true do |t|
t.decimal "amount"
t.string "amount_display"
t.text "description"
t.string "shipping_desc"
t.string "delivery_desc"
t.integer "limit"
t.integer "purchased_count"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
t.string "email"
t.datetime "created_at", :null => false

View File

@@ -5,3 +5,78 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
PaymentOption.create(
[
{
amount: 10.00,
amount_display: '$10',
description: '<strong>Basic level: </strong>You receive a great big thankyou from us! You Rock',
shipping_desc: '',
delivery_desc: '',
limit: -1,
purchased_count: 0
},
{
amount: 100.00,
amount_display: '$100',
description: '<strong>Package 1: </strong>You receive our print edition',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: 250,
purchased_count: 0
},
{
amount: 125.00,
amount_display: '$125',
description: '<strong>Package 2: </strong>You will receive both our print and digital edition',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: -1,
purchased_count: 0
},
{
amount: 200.00,
amount_display: '$200',
description: '<strong>Package 3: </strong>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: -1,
purchased_count: 0
},
{
amount: 250.00,
amount_display: '$250',
description: '<strong>Package 4: </strong>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: -1,
purchased_count: 0
},
{
amount: 300.00,
amount_display: '$300',
description: '<strong>Package 5: </strong>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: -1,
purchased_count: 0
},
{
amount: 500.00,
amount_display: '$500',
description: '<strong>Package 6: </strong>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: -1,
purchased_count: 0
},
{
amount: 1000.00,
amount_display: '$1000',
description: '<strong>Package 7: </strong>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
shipping_desc: 'add $3 to ship outside the US',
delivery_desc: 'Estimated delivery: Oct 2013',
limit: -1,
purchased_count: 0
}
])