Today I wrote a little gem which contains a contact form. It is build with the enginex engine skeleton and is a full mountable rails engine. You can easily integrate the code into your rails project and you can customize it the way you like.
The gem contains a form which gets send by mail to an user. The user gets an auto reply mail and the website administrator gets a mail with the contact data. Just simple, but comfortable.
gem install contact_form
Or add it to your Gemfile:
Run the generator to generate an initializer file, a config yml file and locale files
rails g contact_form:install
You can easily customize all files. The generated file under “/config” contains the mailer recipients, you can change them the way you want. The generated files under “/config/locales” contains i18n keys which can also be changed.
After you run the generator you can mount the engine in your routes.rb
mount ContactForm::Engine => "/contact_form"
and you’ll see the result!
There are following generators available for customizing your contact form:
rails g contact_form:views # generates view files rails g contact_form:models # generates model files rails g contact_form:controllers # generates controller files rails g contact_form:mailers # generates mailer files
Or simple generate all files
rails g contact_form:all # generates all files
The gem is published under the MIT license.
You can find further information on github: https://github.com/mattherick/contact_form
Feel free to open issuses or make a pull request, if something does not work the way you want.