Skip to content
Gem providing simple Contact Form functionality with a Rails 3+ Engine.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Add arabic translation. Aug 6, 2016
config Removed empty line for houndci Aug 8, 2016
lib Rebased from upstream Aug 8, 2016
spec Add controller testing modules. Aug 5, 2016
.gitignore Configurable parent mailer. May 1, 2015
.rspec Rspec 3. Jan 15, 2015
.travis.yml Update travis. Aug 5, 2016 Update changelog. Aug 8, 2016
MIT-LICENSE initial commit May 3, 2011
Rakefile initial commit May 3, 2011
contact_us.gemspec Add rails-controller-testing. Aug 5, 2016

Contact Us Build Status

A Rails 3+ Engine providing a basic contact form.

There is also a demo application showing how the ContactUs form works:


Contact Us requires:

  • Ruby >= 1.9.3
  • Rails >= 3.0.0

It is also recommended to use Formtastic or SimpleForm (see configuration) in order to hook into your apps custom form builders.


In your Gemfile, add the following dependencies:

gem 'contact_us', '~> 1.0.1'

From Rails.root in your Terminal run:

bundle exec rake contact_us:install

In config/initializers/contact_us.rb modify:

config.mailer_to = ""

Change to the email address you would like to receive the form submissions at for example:

config.mailer_to = ""

By default the emails from field will be the email entered by the user to easily reply, but this may not be allowed if your required to verify your sending email addresses. You may also specify an email address for the notification emails from field:

config.mailer_from = ""


If you would like to add a name or subject field to the form you may simply set the options to true within the contact_us initializer located at config/initializers/contact_us.rb:

config.require_name = true
config.require_subject = true

To redirect to a specific URL after a successful form submission:

config.success_redirect = '/contact-success'

If you're using I18n localization and would like to have the locale be a part of your paths For example: /en/contact-us OR /fr/contact-us OR /en-UK/contact-us

config.localize_routes = true


To copy the view files to app/views/contact_us, and customize them to suit your needs run:

bundle exec rake contact_us:copy_views


To copy the locale files to config/locales/contact_us.*.yml, and customize them to suit your needs run:

bundle exec rake contact_us:copy_locales

Please feel free to submit your own locales so that other users will hopefully find this gem more useful in your language.

If you would like to include the locale in your paths (e.g. /en/contact-us), set the localize_routes parameter to true in your initializer (see the configuration section above)


In order to use a Formtastic compatible template to hook into your custom form styles configure config/initializers/contact_us.rb:

config.form_gem = 'formtastic'
  • By default the HTML should match that produced by Formtastic, but to ensure it is up to date you should set Formtastic.


In order to use a SimpleForm compatible template to hook into your custom form styles configure config/initializers/contact_us.rb:

config.form_gem = 'simple_form'


When upgrading from 0.1.x to 0.2.x you should rerun the install generator to install the new settings, views, and locale updates:

bundle exec rake contact_us:install

Or you may run the generators for each specific component you would like to update, which is quite useful when upgrading during patch releases for example from 0.2.0 to 0.2.1:

bundle exec rake contact_us:copy_locales
bundle exec rake contact_us:copy_views


Visit your website and navigate to /contact-us to see the form in action.


Contact Us has 100% test coverage, and provides simple integration specs you can drop directly into your apps test suite if you use RSpec & Capybara.

Simply copy the spec/integration/contact_us_lint_spec.rb file, and add it to your integration specs.


Please report any bugs or feature requests to the Github issues page @


In order to run the spec suite:

bundle exec rspec spec


  • Add new language translations.


In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

  • by using prerelease versions
  • by reporting bugs
  • by suggesting new features
  • by translating to a new language
  • by writing or editing documentation
  • by writing specifications
  • by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
  • by refactoring code
  • by resolving issues
  • by reviewing patches


Bitcoin donations may be sent to: 1Jz1rWG6HSWb6eBGgTyhANrkVxmzY4YPKS

Copyright (c) 2011-2013 Jeff Dutil, released under the MIT license.

You can’t perform that action at this time.