Sha256: 8b540180e61b7a48c6367473ab01f6fc758c249d151b44e2ec041a3ad334e4fc

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

class ContactUs::ContactsController < ApplicationController

  def create
    @contact = ContactUs::Contact.new(params[:contact_us_contact])

    if @contact.save
      redirect_to('/', :notice => t('contact_us.notices.success'))
    else
      flash[:error] = t('contact_us.notices.error')
      render_new_page
    end
  end

  def new
    @contact = ContactUs::Contact.new
    render_new_page
  end

  protected

    def render_new_page
      case ContactUs.form_gem
      when 'formtastic'  then render 'new_formtastic'
      when 'simple_form' then render 'new_simple_form'
      else
        render 'new'
      end
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contact_us-0.4.0 app/controllers/contact_us/contacts_controller.rb
contact_us-0.4.0.beta app/controllers/contact_us/contacts_controller.rb