Sha256: 9f39a293a46fb8299871ec5c367c312641c7865397379e017aa673a32a4e020a

Contents?: true

Size: 960 Bytes

Versions: 27

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

# generado con pg_rails

module Public
  class MensajeContactosController < PublicController
    prepend_before_action only: :create do
      rate_limiting(
        to: 3,
        within: 1.hour,
        by: -> { request.remote_ip },
        with: -> { head :too_many_requests },
        store: cache_store
      )
    end

    include PgEngine::Resource

    self.clase_modelo = MensajeContacto

    layout 'pg_layout/container_logo'

    def new; end

    def create
      if Current.user.present?
        @mensaje_contacto.email = Current.user.email
        @mensaje_contacto.nombre = Current.user.nombre_completo
      end
      if @mensaje_contacto.save
        render turbo_stream: turbo_stream.update('mensaje_contacto', partial: 'gracias')
      else
        render :new, status: :unprocessable_entity
      end
    end

    private

    def atributos_permitidos
      %i[nombre email telefono mensaje]
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pg_rails-7.6.27 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.26 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.25 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.24 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.24.pre.5 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.24.pre.4 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.24.pre.3 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.23 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.22 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.22.pre.3 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.22.pre.2 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.22.pre.1 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.11 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.10 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.9 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.8 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.7 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.6 pg_engine/app/controllers/public/mensaje_contactos_controller.rb
pg_rails-7.6.21.pre.5 pg_engine/app/controllers/public/mensaje_contactos_controller.rb