God day,

I'm quite new to all this RoR thing and I'm setting up Spree store.

I'm trying to pre-configure my store depending on enviroment with seedbank gem. I don't get how to pre-configure Spree::BillingIntergration::PaypalExpress gateway.

I can output all the configuration if i fire up 'rails console' and run

Spree::BillingIntegration::PaypalExpress.find_by_id(1).options

Here is a code: https://github.com/spree/spree_paypal_express

But these values are not stored in database. How can i pre-populate these options with 'rake db:seed'?

Thanks in advance.

Enviroment: rails -v = 3.2.11

ruby -v = ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

spree -v = 1.3.1

有帮助吗?

解决方案

You can add the following code to the db/seeds.rb (or other file if have more advanced structure):

Spree::BillingIntegration::PaypalExpress.create!(
    name: 'Paypal (or whatever you want)',
    description: '',
    active: true,
    environment: Rails.env,
    display_on: '',
    preferred_currency: '<fill_here>',
    preferred_login: '<fill_here>',
    preferred_password: '<fill_here>',
    preferred_signature: '<fill_here>',
    preferred_review: false,
    preferred_no_shipping: false,
    preferred_cart_checkout: true,
    preferred_allow_guest_checkout: false,
    preferred_server: 'test',
    preferred_test_mode: true
)

so as you can see all options are with preferred prefix.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top