I must be really confused - have problems getting data from

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
:slight_smile:
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

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