namespace :payment do task :create => :environment do payment_method_settings = PaymentMethodSetting.where(payment_method: 'PAYMAL') payment_method_settings.each do |payment| MembershipAction.create( { membership_type: "create_payment", is_active: 1, gateway_url: "/api/create_payment", merchant_account_id: payment.merchant_account_id, auth_token: payment.auth_token, shop_code: payment.shop_code } ) end payment_method_settings.update_all({ gateway_url: nil, merchant_account_id: nil, auth_token: nil }) # payment_method_settings.delete_all end end