noob struggling to learn

I am learning Rails by building a real application for someone.
Ultimately the app may become a much larger thing, however for now i
am concentrating on just a tricky login situation. I will essentially
have 2 pages, a 'start' and a 'login' page. 'start' being the initial
screen for the application. What I need this start page to do is pull
the UserID from the URL (assuming the request has the userID) and then
use that UserID to look in a table for another bit of information
(planID type of thing) and store that 'planID' in a session to be
brought forward to the login and beyond. Essentially the login can be
very different depending on that planID, this is the reason for this
work on the start page. The start page may also contain some nice
graphics and a disclaimer or something. I used RAKE MIGRATE to build
my table, I created my model for that table and I created a controller
called 'start'. Everything seems hooked up properly and I can run
it. I created the 'start' controller assuming this logic of grabbing
the ID from the URL, looking in the table (SQL?), and storing the
result ID in the the session would go in the controller? If anyone
could take the time to help me over this block, I would appreciate it
very much. I am not even sure what the ruby code would look like for
searing the table, or the ruby code for grabbing the ID from the URL
or storing the information in the session.

advanced thank you
JR

Jason:

I also recommend it. If you need it right away, you can order a pdf
from http://pragmaticprogrammer.com/titles/rails/index.html.

I also attended Dave Thomas' and Mike Clark's Pragmatic Studio class
which was excellent.

Here are some tips:

1. Lookup routes to see how to get the id from a URL. Your url would
be like http://example.com/controller/action/:id instead of http://
example.com/controller/action?id=blah. You could then access the id
from params[:id] in your controller.
2. To find an object, you don't have to write SQL right away. Lookup
dynamic finders to see how User.find_by_id(:id) will return your user
object. Or, use User.find() if you want more options.

I agree with Richard that you might want to see the book's section on
logins. It will save you lots of effort. I know, because I wrote my
own login stuff and later found out how easy if could have been.

Keep asking questions and good luck,

-Anthony

Thanks to both of you.
JR

ok here is my first pass...

#parse out the userID from th url
#query DB for planID using the userID
#store planID to session to be used going forward

def url
   @planid = userid.find(@params[:id])
end

do you think this method does what I am attempting to do based on my
commented lines?

JR

yes, VERY helpful. But I actualy mistated my intentions slightly.
What I am trying to do is:

#parse out the userID from th url
#query the users table for clientID (using the userID)
#query the plans table (using the newly aquired clientID) for planID
#store planID to session to be used going forward

sorry for the confusion. Your help is appreciated. I would assume
the solution goes in the controller as a method. Most likely in the
users controller hooked up the users table?

thanks again

JR