Contact Us form in Rails 3

后端 未结 3 390
长情又很酷
长情又很酷 2020-12-28 10:00

I simply want a contact us form with name, email and message fields in my Rails app, I don\'t want to save(permanently) the message I just want to send the message as an ema

3条回答
  •  暖寄归人
    2020-12-28 10:05

    I've written a Rails Engine https://github.com/jdutil/contact_us that you can easily drop into any Rails 3+ application. I didn't add a Name field to the form, but you could fork the repo then modify it to suit your needs. It does require the Formtastic gem since I wanted an easy way to hook into peoples existing form styles though.

    To install the Engine add the contact_us gem to your Gemfile:

    gem 'contact_us', '~> 0.4.0'
    

    Run bundle and the install rake task:

    $ bundle
    $ bundle exec rake contact_us:install
    

    Then just modify the generated initializer in /config/initializers/contact_us.rb to have the email you want the form submissions sent to.

提交回复
热议问题