Sha256: a1df2ebd5edf038bf289841de31d23ebcb287556c12d94f426dc1e9deed67ae5
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module RocketCMS module Controllers module Contacts extend ActiveSupport::Concern def new @contact_message = model.new after_initialize end def create @contact_message = model.new(message_params) after_initialize if RocketCMS.configuration.contacts_captcha meth = :save_with_captcha else meth = :save end if @contact_message.send(meth) after_create redirect_to :contacts_sent else flash.now[:alert] = @contact_message.errors.full_messages.join("\n") render action: "new" end end def sent end private def after_initialize # overrideable hook for updating message end def after_create # overrideable hook for updating message end def model ContactMessage end def message_params params.require(:contact_message).permit(RocketCMS.configuration.contacts_fields.keys + [:name, :email, :phone, :content, :captcha, :captcha_key]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rocket_cms-0.5.0 | lib/rocket_cms/controllers/contacts.rb |