Need a better undersanding of form helpers

perhaps someone can take a little time to give me a better
understanding of how to use form helpers.

Here is what I’m working with in my app:
user model - (the table where a user registers their information)
it contains the following fields -
first_name
last_name
email
account_type (currently set to string but will probably be a select
box with options)
password_salt (I’m assuming these would be hidden)
password_hash ( " )

controller main / welcome
def welcome
end

For now all welcome does is pull up the main/welcome.rhtml page
In welcome.rhtml all I have is one line:
<%= render :partial => “user/register” %>

but there is also a main.rhtml layout so welcome.rhtml is embedded in
one of the main layout divs.

Last is the user/register partial:
currently in which i have this code. I know I want to drop this in
favor of form helpers for various reasons, one being styling.

<%= form_tag :controller => “main”,
:action => “register” %>

<%= labeled_text_field “First name”, :user, :first_name %>

<%= labeled_text_field “Last name”, :user, :last_name %>

<%= labeled_text_field “Email”, :user, :email %>

<%= labeled_text_field “Account Type”, :user, :account_type %>

<%= labeled_text_field “Password”, :user, :password %>


<%= end_form_tag %>

My confusion is in a few areas. I’m not sure what I need in the
controller. Right now the user controller has this one method:
def register
c = User.new(params[:user])
c.save
redirect_to :controller => “main”
end

I think this is correct and the right controller for it to be in since
it relates to the user model / object.

Secondly do I use the form helpers in user_helper or main_helper. I
have some attempt at a form helper in main_helper currently. In the
user controller I have helper :main, but maybe I should just keep the
form helpers in user_helper ?

Lastly after I get whatever it is I need in the helper file, what is
it that I put in the view to call it ?

Sorry, I’m having a hard time getting this to sink in.

Stuart

Dark A. <[email protected]…> writes:

account_type (currently set to string but will probably be a select
<%= render :partial => “user/register” %>

def register
user controller I have helper :main, but maybe I should just keep the
form helpers in user_helper ?

Lastly after I get whatever it is I need in the helper file, what is
it that I put in the view to call it ?

Sorry, I’m having a hard time getting this to sink in.

Stuart

Hey Stuart,

My name is Amy and I am part of a search firm located in Midtown NY.

I am currently working on a senior Ruby on Rails position open in NYC.

This is a great full time, full benefits opportunity offering a salary
ranging
from 80K-100K+. Please take a look at the link below for more about
the
position:

http://jobs-sap.icims.com/sap_jobs/jobs/candidate/job.jsp?jobid=1681&mode=view

A little bit about the company:

The company has developed an innovative new platform for interactive
video
sharing. Their framework is largely based on Ruby on Rails along with
other
open source technologies. They have received a lot of media attention
lately
and are doing well.

If you are interested or know anyone whi might be interested, please ask
them
to send me a copy of their resume and get in touch with me for more
details.

I look forward to hearing from you!

Thanks Stuart!

Amy Shah
Sr. Technical Recruiter
Shulman Fleming & Partners
Office:(646) 285-0500 x214
Cell: (732) 485-1740
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs