Sha256: 8d2c78d4e6e5ab86663ee4b8887c7caeb23a72adc2bb07e8ba7b1736c3851cc1

Contents?: true

Size: 737 Bytes

Versions: 3

Compression:

Stored size: 737 Bytes

Contents

class PagesController < ApplicationController
  layout "land"

  # GET /
  def home
    @newsletter_form = NewsletterForm.new
  end

  # POST /subscribe
  def subscribe
    @newsletter_form = NewsletterForm.new(newsletter_form_params)

    respond_to do |format|
      if @newsletter_form.save
        format.html { redirect_to root_url, success: "Successfully subscribed" }
        format.js { flash.now[:notice] = "Successfully subscribed" }
      else
        format.html { render :home }
        format.js
      end
    end
  end

  private

  # Never trust parameters from the scary internet, only allow the white list through.
  def newsletter_form_params
    params.require(:newsletter_form).permit(:email, :suppressed)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
saaskit-0.1.2 lib/generators/saaskit/install/templates/app/controllers/pages_controller.rb
saaskit-0.1.1 lib/generators/saaskit/install/templates/app/controllers/pages_controller.rb
saaskit-0.1.0 lib/generators/saaskit/install/templates/app/controllers/pages_controller.rb