Sha256: 2f6cf32a45b4d4174d3897a5e52652e4dc4802854612bb43f4d08c239f213dea

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require_dependency "wafflemix/application_controller"

module Wafflemix
  class ContactFormsController < ApplicationController

    before_filter :find_page

    def show
      @contact_form = ContactForm.find(params[:id])

      respond_to do |format|
        format.html
        format.json { render json: @contact_form }
      end
    end

    def new
      @contact_form = ContactForm.new
  
      respond_to do |format|
        format.html
        format.json { render json: @contact_form }
      end
    end

    def create
      @contact_form = ContactForm.new(params[:contact_form])
  
      respond_to do |format|
        if @contact_form.save
          format.html { redirect_to @contact_form, notice: 'Contact form was successfully created.' }
          format.json { render json: @contact_form, status: :created, location: @contact_form }
        else
          format.html { render action: "new" }
          format.json { render json: @contact_form.errors, status: :unprocessable_entity }
        end
      end
    end

    private

      def find_page
        @page = Page.find_by_link_url('contact-us')
      end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wafflemix-0.0.4 app/controllers/wafflemix/contact_forms_controller.rb
wafflemix-0.0.3 app/controllers/wafflemix/contact_forms_controller.rb
wafflemix-0.0.2 app/controllers/wafflemix/contact_forms_controller.rb
wafflemix-0.0.1 app/controllers/wafflemix/contact_forms_controller.rb