Contact page creation

17 views
Skip to first unread message

bradford li

unread,
Jul 18, 2014, 2:36:39 AM7/18/14
to rubyonra...@googlegroups.com
I am new to ruby on rails and I am trying to create a small website as practice. Right now I am in the process of creating a Contact page. Basically this page will be a form to allow visitors send an email to only me. This form will have name, message, subject and other information a typical contact me page will have. I am new and I'm not sure where to start. Could someone guide me through this process? I am open to gems but I am also curious on how to perform this action without gems so I can learn more about the rails framework. Thanks!

BalaRaju Vankala

unread,
Jul 18, 2014, 3:07:25 AM7/18/14
to rubyonra...@googlegroups.com
Create a model Contact:

rails g model contact name:string subject:string message:text


Create a controller contacts
rails g controller contacts

add routes
routes :contacts

Create a view page
 
new.html.erb
--------------------
<%= form_for @contact %>
   -----your code ----
<% end %>

controller :
------------------
def new
  @contact = Contact.new
end

def create
  @contact.save
 #write here action mailer method
end


for mailing see below link:
-------------------------------------

http://guides.rubyonrails.org/action_mailer_basics.html




On Fri, Jul 18, 2014 at 12:06 PM, bradford li <bradf...@gmail.com> wrote:
I am new to ruby on rails and I am trying to create a small website as practice. Right now I am in the process of creating a Contact page. Basically this page will be a form to allow visitors send an email to only me. This form will have name, message, subject and other information a typical contact me page will have. I am new and I'm not sure where to start. Could someone guide me through this process? I am open to gems but I am also curious on how to perform this action without gems so I can learn more about the rails framework. Thanks!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d5e1ad03-d8bf-45fe-8ba4-772bbb55236d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
----------------------------------------------------------------------------------------------------
Thank You.

Best Wishes,
 
BalaRaju Vankala,
8886565300.


Colin Law

unread,
Jul 18, 2014, 5:05:36 AM7/18/14
to rubyonra...@googlegroups.com
Start by working right through a good tutorial such as
railstutorial.org (which is free to use online). That will show you
the basics of Rails.

Colin

Pardeep Dhingra

unread,
Jul 18, 2014, 8:44:10 AM7/18/14
to rubyonra...@googlegroups.com
You should create virtual model in case of contact page as you are not
going to store contact information in database.

http://railscasts.com/episodes/219-active-model

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages