Sha256: 9406c0787e5c2448d836fa458ec6a91131f300965219f6a6c8d3e7d0cc4febcd
Contents?: true
Size: 671 Bytes
Versions: 1
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true module Spree class NewslettersController < StoreController def create @newsletter = Spree::Newsletter.find_or_initialize_by(newsletter_params) if @newsletter.persisted? flash[:notice] = I18n.t('spree.newsletter.controller.already_subscribed') else if @newsletter.save flash[:success] = I18n.t('spree.newsletter.controller.success') else flash[:error] = I18n.t('spree.newsletter.controller.error') end end redirect_to root_path end private def newsletter_params params.require(:newsletters).permit(:name, :email) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_newsletter-1.1 | app/controllers/spree/newsletters_controller.rb |