Class: Account::ProfilesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Account::ProfilesController
- Defined in:
- app/controllers/account/profiles_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
caches_page_with_cache_marker, #raise_not_found!
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/account/profiles_controller.rb', line 27 def create @form = @group.build_form(params) if @group.default? && defined?(@form.country_code) @form.country_code ||= current_account.profile.country_code end @form.submit if @form&.valid? case @group when ProfilePageType.default current_account.clear_profile_cache when ProfilePageType.billing current_account.clear_billing_cache end respond_with(@form, location: edit_account_profile_path(page_type: @group.slug)) end |
#destroy ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/account/profiles_controller.rb', line 49 def destroy @removed = TranslationCms::Api::Profile::Control.drop sign_out :account respond_with do |format| format.js { render } format.all { redirect_to root_path } end end |
#edit ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/account/profiles_controller.rb', line 14 def edit @group = ProfilePageType.find_by(slug: params[:page_type]) case @group when ProfilePageType.billing @billing_pref = TranslationCms::Api::Customers::BillingAddress.all.first when ProfilePageType.mailing @mailing_pref = TranslationCms::Api::Customers::Notification.all @mailing_pref = @mailing_pref.first if @mailing_pref.is_a?(Array) end respond_with(@account) end |
#export ⇒ Object
44 45 46 47 |
# File 'app/controllers/account/profiles_controller.rb', line 44 def export @export = TranslationCms::Api::Profile::Export.prepare respond_with @export end |