Ok so I have a profile page on my website. In the database I have all the information about the user, including the username, first and last names, passwords, and descriptions, locations, and any other information. Now what code would I need, to get the data from the table "users" depending on who is logged into the system. Say "Bob" is logged in, how do I get ruby to look for "Bob" in users and, let's say, display the user's current location and/or First and Last name. And don't be too harsh, I'm completely new to RoR and still trying to get stuff to "make sense".
on 2007-06-19 00:45
on 2007-06-19 01:36
If you are completley new to Ror I would suggest reading some of the thousands of tutorials on the web, or one of the several books about Rails that are out now (Agile Web Development With Rails 2nd Edition is the crowd favorite). The answers to your questions aren't that simple. How does the application know what user is logged in? You can search your database like this... @user=User.find_by_username(Bob) Where 'username' is the column in the DB you want to search and 'Bob' is what to search for. The entire row will be returned as an array @user, so then you can use @user.location @user.first_name @user.last_name or @user.whatever Usually developers store the user_id in the session information, so you can do something like @user = User.find(session[:id]) I hope this gets you on the right path, but you really need to start reading up... :) On Jun 18, 6:45 pm, Jake Fake <rails-mailing-l...@andreas-s.net>