What's the solution for "contact forms" in Ruby on Rails applications?

A quick Google search can find hundreds of examples for contact forms using PHP and / or JavaScript, but there doesn't seem to be any "ready-made" contact forms for Ruby on Rails. They exist? What do you use for contact forms in your Ruby on Rails applications?

+2


a source to share


2 answers


Personally, I use the ActiveRecord model for mine as I like to store the sent messages and then use the ActionMailer after saving the record to send the email.

Alternatively, there is a gem called MailForm that allows you to build a form model without a database table that will work with other gems like Formtastic.



As far as ready-made contact forms go, I don't know of any (although they may well exist) as it isn't particularly time consuming to build from scratch.

+2


a source


I ran into the same problem, wanting to easily use the Contact Form, but couldn't find it. So I wrote a ContactUs Rails engine that can be easily loaded into any Rails 3+ application. I've tried to keep it dead simple and easily customizable. This requires a Formtastic gem, as I would like to easily hook into existing people stylesheets.

To install the engine, add the contact_us file to your Gemfile:

gem 'contact_us', '~> 0.1.3'

      



Run the package and the rake installation task:

$ bundle
$ bundle exec rake contact_us:install

      

Then just change the generated initializer in / config / initializers / contact_us.rb to get the email that the submitted forms are submitted to.

+2


a source







All Articles