Sha256: e2f702adcf8204a13f062d36929fc21d6faafdb8276e1e8b5e9d36fe7a3b9488

Contents?: true

Size: 861 Bytes

Versions: 20

Compression:

Stored size: 861 Bytes

Contents

module Effective
  class CustomersController < ApplicationController
    layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:customers] : EffectiveOrders.layout)

    include Effective::CrudController

    submit :save, 'Save', redirect: :back, success: -> { 'Successfully updated card.' }
    page_title 'Customer Settings'

    def resource
      @customer ||= Effective::Customer.where(user: current_user).first!
      @subscripter ||= Effective::Subscripter.new(customer: @customer, user: @customer.user)
    end

    # I don't want save_resource to wrap my save in a transaction
    def save_resource(resource, action, to_assign)
      resource.assign_attributes(to_assign)
      resource.save!
    end

    # StrongParameters
    def customer_params
      params.require(:effective_subscripter).permit(:stripe_token)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
effective_orders-4.0.6 app/controllers/effective/customers_controller.rb
effective_orders-4.0.5 app/controllers/effective/customers_controller.rb
effective_orders-4.0.4 app/controllers/effective/customers_controller.rb
effective_orders-4.0.3 app/controllers/effective/customers_controller.rb
effective_orders-4.0.2 app/controllers/effective/customers_controller.rb
effective_orders-4.0.1 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta19 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta18 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta17 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta16 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta15 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta14 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta13 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta12 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta11 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta10 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta9 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta8 app/controllers/effective/customers_controller.rb
effective_orders-4.0.0beta7 app/controllers/effective/customers_controller.rb