# I must be really confused - have problems getting data from

**URL:** <https://www.ruby-forum.com/t/i-must-be-really-confused-have-problems-getting-data-from/225965>\
**Category:** Rails\
**Created:** [September 6, 2007, 12:08am UTC](https://www.ruby-forum.com/t/i-must-be-really-confused-have-problems-getting-data-from/225965 "2007-09-06T00:08:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rustyc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ba8739/32.png) [@rustyc](https://www.ruby-forum.com/u/rustyc)\
**Post date:** [September 6, 2007, 12:08am UTC](https://www.ruby-forum.com/t/i-must-be-really-confused-have-problems-getting-data-from/225965/1 "2007-09-06T00:08:45Z")

</div>

First post here, hopefully I’ve got it in the right place! Sorry if  
not!

Ok, so I’m creating a web app for a ham radio support web site.

It takes an ‘application to join’ the membership, saves all the info to  
the DB, sends them email with confirmation code, takes the confirmation  
code, finds the info in the DB and re-displays the data from the DB so  
that they can verify and make any changes they want.

I have 2 major problems -

1 - I cannot figure out how to get the silly check boxes to be checked,  
even ignoring the DB.

2 - I’m still pretty unclear how to get the updated data from the web  
page back to the db.

Here’s the layout:

we have elmers\_controller which sets up the application to join page,  
and looks something like this (this is a small part of it - total is  
like 7000 lines):

def registration\_page  
@mailtypes = EmailType.find(:all)  
…etc… (3 more)  
end

def process\_registration  
@ham = Ham.new(params[:ham])  
@ham.active = 0  
@ham.general\_comments = params[:webpage][:general\_comments]  
@ham.private\_comments = params[:webpage][:general\_comments]  
…etc… (something tells me I’m doing THAT all wrong (getting stuff  
into the ham record)  
…lots of code follows, getting stuff from things (including a bunch of  
parameterized lists)  
end

(so, the ‘registration\_page’ sets up the page they fill info in to, and  
‘process\_registration’ takes that info out of the web page and sticks it  
into  
the different database fields (and sends the email) (there are lots -  
more  
detail is available if anyone wants it)

Now, when they come back, they get to this:

def verify\_data\_and\_confirm  
pv = PendingVerification.find(… finds the ‘pending verification’  
record for this ham)  
@hamid = pv.ham\_id # - gets ham\_id from pending verification  
@ham = Ham.find(@hamid) # - gets Ham from DB  
…so on and so forth, getting fields into variables for the web  
page…  
…(but I must say, its not very long, mostly setting ‘@foo =  
foo\_from\_db’)  
end

So, that shows the page with their stuff filled out (but no check boxes,  
more’s the pity).

Then, they change stuff and hit ‘submit’, and we hit:

def confirm\_registration\_and\_update\_info  
@haminfo = get\_haminfo  
@hamsecrets = @haminfo.get\_secrets # … secrets has password and so  
forth.  
hamid = @haminfo.get\_hamid  
@ham = Ham.find(hamid) # get original ham from DB  
@ham.active = 1  
@ham.general\_comments = params[:webpage][:general\_comments]  
@ham.private\_comments = params[:webpage][:private\_comments]  
… more field setting…  
@ham.save  
… so on and so forth… This seems messed up, and it also doesn’t work  
🙂  
end

Surely I’m doing something really wrong here - I’ve even gotten the RoR  
book and not been able to figure it out from there - I’m clearly off in  
the weeds - can anyone point me back to the well-traveled area? Thanks!

rc
