Sha256: f9f54b72680063c2a479bee50f3ec97ed6ed4201e8a2dd6f19a246d6dfbd0187
Contents?: true
Size: 949 Bytes
Versions: 18
Compression:
Stored size: 949 Bytes
Contents
class Admin::PaymentMethodsController < Admin::BaseController resource_controller before_filter :load_data update.before :update_before update.wants.html { redirect_to edit_object_url } create.wants.html { redirect_to edit_object_url } private def build_object if params[:payment_method] && params[:payment_method][:type] @object ||= params[:payment_method][:type].constantize.send parent? ? :build : :new, object_params else @object ||= end_of_association_chain.send parent? ? :build : :new, object_params end end def load_data @providers = Gateway.providers end def update_before if params[:payment_method] && params[:payment_method][:type] && @object['type'].to_s != params[:payment_method][:type] @object.update_attribute(:type, params[:payment_method][:type]) load_object end @object.update_attributes params[@object.class.name.underscore.gsub("/", "_")] end end
Version data entries
18 entries across 18 versions & 2 rubygems